Custom dropdown for CComboBox

Posted by WalderFrey on Stack Overflow See other posts from Stack Overflow or by WalderFrey
Published on 2010-04-11T07:34:04Z Indexed on 2010/04/11 7:43 UTC
Read the original article Hit count: 274

Filed under:
|
|
|

I'm trying to create a custom dropdown for a derivative of CComboBox. The dropdown will be a calendar control plus some 'hotspots', e.g.

Image Hosted by ImageShack.us

So I figure the best way to achieve this is to have a simple CWnd-derived class which acts as the parent to the calendar control, and have it paint the hotspots itself.

The window needs to be a popup window - I think - rather than a child window so that it isn't clipped. But doing this causes the dialog (on which the combobox control is placed) to stop being the topmost (foreground?) window, leading to its frame being drawn differently:

alt text

This spoils the illusion that the dropdown is part of the combobox since its acting more like a modal dialog at this point. Any suggestions on how I make the custom dropdown behave like the regular dropdown?

Are there any other pitfalls I need to watch out for, e.g. focus and mouse capture issues?

© Stack Overflow or respective owner

Related posts about c++

Related posts about mfc