|
|
|
I'm trying to prevent the root node of my subclassed CTreeCtrl from being collapsed. The root node is guaranteed to have children. I've reflected TVN_ITEMEXPANDING to the control and am returning TRUE in its handler to prevent the root from being collapsed, but the user seems to be able to collapse it anyway.
BOOL CProjectTreeCtrl::OnItemExpanding
(NMHDR* pNMHDR, LRESULT* pResult)
{
NMTREEVIEW* pNMTreeView = (NMTREEVIEW *) pNMHDR;
HTREEITEM hItem = pNMTreeView->itemNew.hItem;
if (pNMTreeView->action == TVE_COLLAPSE)
if (hItem == m_hRoot)
return (TRUE);
return (FALSE);
}
I can get around the problem by handling TVN_ITEMEXPANDED , but that's ugly because the node collapses then expands.
Any clues as to what I'm doing wrong? Thanks,
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Thanks, Nick but I'm already able to re-expand the collapsed node by calling Expand() . I was hoping to prevent the about-to-be-collapsed node from collapsing.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You have to set *pResult = TRUE; and the notification handler has to be void!
void CProjectTreeCtrl::OnItemExpanding(NMHDR* pNMHDR, LRESULT* pResult)<br />
{<br />
NMTREEVIEW *pNMTV = (NMTREEVIEW*)pNMHDR;<br />
*pResult = pNMTV->action == TVE_COLLAPSE && pNMTV->itemNew.hItem = m_hRoot;<br />
}
Regards,
BB
|
|
|
|
|
Of course, of course, of course!!! Thank you, thank you, thank you! (Lesson learned: don't try to code when you're sick!)
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You're welcome. I've just added a sample code, but I guess you've already fixed it. OK then - yet another reason to feel more healthy )
Regards,
BB
|
|
|
|
|
I need a sample from the Aug 2001 Platform SDK CD. I don't have the CD available to me, but need it fairly urgently. It's the customdial sample, and should be located in the
\Samples\NetDs\RAS\CustomDial sample
directory on the CD. I'd appreciate it if somebody could email this to me.
________________________
http://www.webreaper.net
|
|
|
|
|
Mark, I've made it available here[^]. (You didn't post your email address ).
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks very much.
________________________
http://www.webreaper.net
|
|
|
|
|
Glad you got it- I was about to email it to you myself.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
How can I search for a string by columns in the listview using FindItem.
Thanks
|
|
|
|
|
Hmm, I think you might have to use GetItemText() instead.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I wrote the following program to test what I think is a bug in the implementation of VC++ 6 templates. For some reason the first call's parameters are ignored and the second call is repeated twice.
<br />
#include "stdafx.h"<br />
#include <stdio.h><br />
<br />
template<class DATAType,DATAType data>Test()<br />
{<br />
printf("Sizeof DATAType %d\n",sizeof(data));<br />
printf("Data = %d\n",data);<br />
}<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
Test<char,0>();<br />
Test<int,1>();<br />
return 0;<br />
}<br />
The output is:
Sizeof DATAType 4
Data = 1
Sizeof DATAType 4
Data = 1
I had a friend compile this on g++ and it worked as expected.
Sizeof DATAType 1
Data = 0
Sizeof DATAType 4
Data = 1
|
|
|
|
|
and if you reverse the order of the calls, it uses the char version of the function twice.
cool.
definitely looks like a bug, to me.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
A quick fix on this is to pass data as a parameter to the function instead of a template parameter.
John
|
|
|
|
|
This is a well-known VC++ bug. The compiler is unable to deduce the template parameters unless they're present in some form in the arguments for the function. Try the following workaround (I don't have my VS handy, but I'm reasonably sure it works):
#include "stdafx.h"
#include <stdio.h>
template<class DATAType,DATAType data>Test(DATAType* dummy=0)
{
printf("Sizeof DATAType %d\n",sizeof(data));
printf("Data = %d\n",data);
}
int main(int argc, char* argv[])
{
Test<char,0>();
Test<int,1>();
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can i display an image stored in the resources in the application in an HTML File which is displayed in a CDHtmldialog ???
I would like also not to have to specify the name of the application, if this is possible.
Thanks.
|
|
|
|
|
In your res file you need a folder resource named "GIFS".
Then add your image to the project in that folder and name it with quotes:
"MyImage.gif"
Then in the html page refer to it like you normally would in any html file:
background="GIFS/MyImage.gif" (as an example for using it as a background)
Art
|
|
|
|
|
Hi,
I get the following runtime error:An attempt was made to access an unnamed file past its end.
With this code where i try to open a textfile and put them in a stringarray.
<br />
CFile cfFile;<br />
<br />
cfFile.Open(dlg.GetPathName(), CFile::modeRead);<br />
<br />
CArchive ar (&cfFile, CArchive::load);
<br />
CStringArray test;<br />
test.Serialize(ar);
Thanks for helping!
Willem
|
|
|
|
|
You may want to first serialize the size of the CStringArray , followed by each CString element. See "Serializing a homogenous collection class" in this[^] article
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hi guys ,
i build a DLL file using .DEF function specifier ,now when i want to use the DLL in other application compiler throw me LNK2019 like errors .
does anybody give me a pattern in using DLL within win32 application .
thank u in advance.
|
|
|
|
|
hello,
i have another problem with child window, when i want to allow resizing i display border and when i want to prevent resizing i hide border.
now i do this to show Sizable Border:
pChild->ModifyStyle(0 ,WS_SIZEBOX ,SWP_NOSIZE | SWP_NOMOVE |SWP_SHOWWINDOW );
pChild->SetWindowPos(NULL, 0, 0, 0,0,
SWP_FRAMECHANGED |
SWP_NOMOVE | SWP_NOSIZE |
SWP_NOZORDER);
before do this i have scrolled my view with :
ScrollWindow(-posHorz,-PosVer);
my problem is when i want to show the border the view do a "ScrollTo (0,0)" ! i put "SWP_NOMOVE " in the SetWindowPos my child window don't move and why my view repositioned to (0,0) ??
i have try to remove SWP_FRAMECHANGED in the SetWindowPos and my view don't move but sizable borders aren't show!
If you know how to add sizable border and remove them easily ...
Excuse me for very bad english
|
|
|
|
|
Hail everyone,
I wonder, what gonna happen with STL container, let's say vector, if there is no memory for add new element? Method push_back returns nothing. In source code of vector I was able to find only 2 exceptions, _Xlen (length_error) and _Xran (out_of_range), but nothing else.
I'm not very familiar with STL, so any help is appreciated.
Thanks in advance.
|
|
|
|