|
I've never used the IHTMLEditDesigner interface. When I need to provide DHTML into a CHtmlView I use JavaScript inside the DHTML code and search for a certain tag id (get_id).
In the case you've exposed, I agree with you that get_srcElement it'd be the correct method to know the event source. Have you trusted that TranslateAccelerator only fires one time for each keybord hit? I mean if you validate the DISPID (DISPID_HTMLELEMENTEVENTS2) to be the correct one.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
hi all... want to exchange a list control data between dialogs, but when I tried it, it failed and I don't know why..can anyone help?
//I initialize the 2nd dialog at the 1st dialog class
CAddNeighborsDialog* dlg = new CAddNeighborsDialog;
int count = 0;
/*inserting data to m_listAddNeighbors(CListCtrl data type)in dialog 2 from m_strData(CStringArray data type)*/
while(count*29<m_strdata.getsize())
{
="" int="" nitem="dlg-">m_listAddNeighbors.GetItemCount();
dlg->m_listAddNeighbors.InsertItem(nItem,m_strData.GetAt((count*29)+10));
dlg->m_listAddNeighbors.SetItemText(nItem,1,m_strData.GetAt((count*29)+1));
count++;
}
if(dlg->DoModal() == IDOK)
{
//I try to test it using message box, but the message box shows nothing
MessageBox(dlg->m_listAddNeighbor.GetItemText(0,1));
}
}
pls help...
thx
|
|
|
|
|
I am not sure about the rest of your code, but...
firebolt77 wrote:
//I try to test it using message box, but the message box shows nothing
MessageBox(dlg->m_listAddNeighbor.GetItemText(0,1));
This is definitely not going to work, because all controls on a dialog die, when DoModal() comes back. Therefore, you are using GetItemText() from a list control that does not exist.
You can try this:
Keep a list. E.g, CStringArray variable in your dialog, then override OnOK(), and fill this CStringArray with the items etc in OnOK(). Then later, after DoModal(), you can access this list, and it will still contain the data.
this is this.
|
|
|
|
|
thx...it works...
Thx for the reply...
|
|
|
|
|
I imagine that it's because the dialog it's been destroyed after closing it: add a breakpoint into OnDestroy message handler in your dialog's class. It doesn't fail because it still exists but it has no value.
You should retrieve the data before it's destroyed but it depends on how/where you have defined the dialogs.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
firebolt77 wrote:
CAddNeighborsDialog* dlg = new CAddNeighborsDialog;
Why do this, especially when there is no delete shown? It just ties up the memory manager unnecessarily.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello All
I want to do a multiple selction of items in combo box,So how should i proceed for that . can anybody help me about this ?
Thanks in advance,
Santosh
|
|
|
|
|
You need to use CListBox[^] instead of a combo box.
In the resource editor you can set the List box properties to have multiple selection behavior: "Styles" tab > "Selection" Drop down menu. Then you are able to use GetSelCount, ...
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I want to pass member variable values b/w different dialog boxes of my application.How I do that....do I have to make one dialog box class parent of another??how i do that??
|
|
|
|
|
The parent dialog or window is the one that comes in first and gets out last. It creates other dialogs, windows etc.
My bit-weird way would be:
Make pointer-variables for each of shared variables in the parent.
Assign them the address of the variable in the child dialog when creating the dialog.
E.g.
class CParent
{
int* m_pVariable;
};
CChild* c;
c = new CChild;
m_pVariable = &c->m_Variable;//put the address of the variable in parent when creating the child.
Now...
class CSecondChild
{
int* m_pVar;
};
CSecondChild* cc;
cc = new CSecondChild;
cc->m_pVar = m_pVariable;
Here, the value in CSecondChild::m_pVar is the value of the variable CChild::m_Variable.
When you change m_Variable in CChild, it is reflected in CSecondChild's m_pVar.
My code is confusing I think.
this is this.
|
|
|
|
|
jee haan app ka code is definitly cofusing....dont u think this can be done by making one dialog class parent of another....Ive done this and it works...but the problem is that I want to pass all the values of child dialogs back to the main dialog.
Thanx for the reply
AH
|
|
|
|
|
I don't exacly get your point. Do you have all child dialogs visible at the same time, or is it DoModal() for each child dialog?
If you are using DoModal() for each child, then get the data from each of them:
CChild c;
if (c.DoModal() == IDOK)
{
int a = c.m_Variable; //Do this for all variables you need.
...
}
this is this.
|
|
|
|
|
Respected all
Regards!
the last time i recieved the answers of my query was not a professional way. that's y i m sent again
how i can read data from a data file which has extenstion is *.Dat which is in the follwing format
---------------------------
filename.dat
data file
genertaed from the processing of the control system
dfgdfgdfg cgb fbgd
345345 dgdfg
dgdfg
XLOC YLOC INDIX
45 56 2344
56 67 1245
50 90 4562
45 87 9337
-----------------------------------------------------------------
and in the given data file i have to read only the data of columns under XLOC,YLOC,INDIX and the file always is in this format.
So please guide me.
waiting for + response.
david
|
|
|
|
|
FILE* fp;<br />
char x[20], y[20], index[20];<br />
int i;<br />
int ind;<br />
char buf[200];<br />
int len;<br />
fp = fopen("text1.dat","r");<br />
while (! feof(fp))<br />
{<br />
memset(buf,0,sizeof(buf));<br />
fgets(buf,200,fp);<br />
len = strlen(buf);<br />
if (len == 0)<br />
continue;<br />
<br />
memset(x,0,sizeof(x));<br />
memset(y,0,sizeof(y));<br />
memset(index,0,sizeof(index));<br />
<br />
ind = 0;<br />
i = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
x[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
i++;<br />
ind = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
y[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
i++;<br />
ind = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
index[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
<br />
MessageBox(x);<br />
MessageBox(y);<br />
MessageBox(index);<br />
<br />
}<br />
fclose(fp);
What you need to do is string-processing, not some filing technique.
I hope it works.
this is this.
|
|
|
|
|
a_david123 wrote:
the last time i recieved the answers of my query was not a professional way.
This example works. Why haven't you tried it?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i am trying to create a windows explorer type application in vc++.i am able to update the TreeView for the directory list. But i am unable to populate the ListView(right pane).i have listed the code below..
void CDirTreeDemoView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
GetListCtrl ().InsertColumn (0, _T ("File Name"), LVCFMT_LEFT, 192);
GetListCtrl ().InsertColumn (1, _T ("Size"), LVCFMT_RIGHT, 96);
GetListCtrl ().InsertColumn (2, _T ("Last Modified"), LVCFMT_CENTER,128);
}
any help plz
thanks
|
|
|
|
|
<br />
BOOL CDirTreeDemoView::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.style |= LVS_EDITLABELS | LVS_REPORT;<br />
return CListView::PreCreateWindow(cs);<br />
}<br />
<br />
void CDirTreeDemoView::OnInitialUpdate()<br />
{<br />
CListView::OnInitialUpdate();<br />
CListCtrl& refCtrl = GetListCtrl();<br />
CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());<br />
refCtrl.InsertColumn(0, _T("File Name"), LVCFMT_LEFT, 192);<br />
refCtrl.InsertColumn(1, _T("Size"), LVCFMT_RIGHT, 96);<br />
refCtrl.InsertColumn(2, _T("Last Modified"), LVCFMT_CENTER, 128);<br />
<br />
DWORD dwExListStyles = LVS_EX_FULLROWSELECT;<br />
GetListCtrl().SetExtendedStyle(dwExListStyles);<br />
}<br />
Maybe this will help
P.
|
|
|
|
|
Nithyb wrote:
But i am unable to populate the ListView
Why? What problem(s) are you having?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hello...
supposed you have two bitmap images in your form, say bitmap1 and bitmap2... how can you get the difference(image subtraction) of the two images...
thank u in advanced....
|
|
|
|
|
First, you need to get the dimensions of the bitmaps, then allocate an appropriate array (wid*hei*bpp/8 bytes). Use the GetBitmapBits function to populate the array. Do the same with the second array. Subtract them byte by byte. Use the SetBitmapBits to fill the CBitmap.
Live long and in prosper
johny74656@gmail.com
|
|
|
|
|
I want to have a reset button on my dialog box which restore the control values to their original values.Any clue which function shud I call in the reset button function??
|
|
|
|
|
I usually keep the default values in a config file..then read in from the file and update to the control values. Not sure if this is the best method.
Aaron
|
|
|
|
|
I'd store the default values in an XML file that you'd load at the beginning
and then you'll have to reset each component one by one. The best automated thing you can do is to group all the edit box to have their resource id consequtive so the you'll be able to do in case you want to reset them:
for(int i = iFirstResId; i <= iLastResId; i++)
SetDlgItemText(i, "");
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Or use the UpdateData function sending in the right parameter (I can never remember if it's TRUE or FALSE). As long as you haven't called it yet to update the variables, calling it with the right parameter will put whatever the variables' value are back in the controls
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
If you've designed it properly, my suggestion would be to simply click the Cancel button and then open the dialog up again. All of the initial (default) values will be present at that point and you will not have had to resort to some "reset" button.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|