Click to See Complete Forum and Search --> : Ownerdraw listbox


HotSouce
March 16th, 2004, 08:57 AM
Hello

I'm trying to create an ownerdraw popup listbox and to handle the WM_DRAWITEM message in its WndProc function. But unfortunately I noticed that this message is not sent. The listbox control should be in a toolbar(not in dlg), so there is no DlgProc where this message can be handled.

Does anybody have idea how to create such a control and to handle WM_DRAWITEM in its WndProc function?

All the syles which are necessary to make the listbox ownerdrawn(WS_POPUP,LBS_OWNERDRAWFIXED) are set.

I hope somebody help me to solve this problem.

Thanks in advance.

HotSouce

NoHero
March 16th, 2004, 09:38 AM
If the listbox is a child of the toolbar, the listbox sends it's messages to the toolbar. You can set the parent of the listbox (With SetParent(...)) or hook the toolbar ...

That could be the problem, if not write back ;)

Ng NoHero

mlepikhin
March 23rd, 2004, 12:25 PM
If you are using MFC you may try message reflection mechanism and overriding of DrawItem function of CComboBox. Otherwise, if you have control over your combo-box parent, you may 'reflect' WM_DRAWITEM by yourself by sending user-defined message from the parent to the combo-box.

Maksim Lepikhin
http://www.softforpros.com