wxMSW: owner-drawn menu changes

Robin Dunn robin at alldunn.com
Fri Jan 26 11:31:50 PST 2007


Hi,

I may have uncovered a problem in the recent changes (from rev 1.141 to 
1.143) in src/msw/menu.cpp that I'd like some feedback on.  There are 
some menu items in Chandler that are checkable and that have both a 
checked and unchecked bitmap specified.  This is currently resulting in 
the InsertMenuItem  API call to fail:

Debug: \Projects\osaf\wx-trunk\src\msw\menu.cpp(486): 'InsertMenuItem()' 
failed with error 0x00000057 (the parameter is incorrect.).

With a little experimentation with the recent changes it appears that 
the API doesn't like the mii.hbmpChecked and mii.hbmpUnchecked members 
to be set to HBMMENU_CALLBACK.  If instead I set them to the HBITMAP of 
the bitmaps in pItem then there is no complaint, but the problem warned 
about in the comments (selected item draws the bitmap inverted) happens.

I also tried not setting MIIM_BITMAP and mii.hbmpItem if the item is 
checkable in case they are mutually exclusive, but that still resulted 
in the debug log message.

Any other ideas?

BTW, even when the API fails and the debug log message is printed the 
menu items are still being drawn correctly.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wx-dev mailing list