Topic: OWL 2: Problems w/WM_COMPAREITEM and TListbox
Author: rugene@aol.com (Rugene)
Date: 7 Jan 1995 09:37:18 -0500 Raw View
When using an "ownerdraw" listbox I have been unable to
get windows to generate WM_COMPAREITEM messages back to
the listbox's owning window when adding items to the listbox.
Can anybody help me out?
Please contact me at rugene@aol.com. THANKS!
using Borland's OWL 2 here's my code fragment:
(I'm using MDI style windows)
DEFINE_RESPONSE_TABLE1(mdiMYChild, TMDIChild)
...,
EV_WM_COMPAREITEM,
...,
END_RESPONSE_TABLE;
//constructor for mdi child
mdiMYChild::mdiMYChild() : TMDIChild (parent, title) {
....
FileList = new TListBox(this, IDC_LIST, 10, 10, 200, 200);
//resource version is not used due to some special placement
// requirements.
FileList->Attr.Style |=LBS_SORT|LBS_NOTIFY|LBS_OWNERDRAWFIXED;
....
}
void mdiMYChild::SetupWindow () {
...
add some items to the listbox
...
}
void mdiMYChild::EvDrawItem (UINT ctrlId, DRAWITEMSTRUCT far& drawInfo)
{ ...do the owner draw stuff...}
LRESULT mdiMYChild::EvCompareItem(UINT, COMPAREITEMSTRUCT far& cis)
{
//this code never gets called! Why not?///////////
LPSTR text1, text2;
text1 = ( (TItem*) cis.itemData1)->Name;
text2 = ( (TItem*) cis.itemData2)->Name;
return lstrcmp(text1, text2);
}
Please contact me at rugene@aol.com. THANKS!
rugene@aol.com