Change fg/bg Colour for menu items [MSW2.9]
Vadim Zeitlin
vadim at wxwidgets.org
Sat Nov 3 12:07:08 PDT 2007
On Sat, 3 Nov 2007 10:11:07 +0100 Andreas Oppermann <Andreas-Oppermann at oss-gmbh.de> wrote:
AO> I played around in the ownerdrw.cpp sample and found out that
AO> only during creation you have to specify the attribute "IsOwnerDrawn"
AO> because there is a different handling:
Yes but normally making it owner-drawn later should work too... But
looking at the code again I think I now know why it did work for me in the
sample but not for you: in fact all items in a menu are made owner-drawn if
one of them is. So I should have tested in e.g. the minimal sample and not
the ownerdraw one. And, indeed, I do see the problem there.
AO> My solution is to create a new menutree with the existing items but
AO> including the different color setting.
Well, this is not really a solution, more like a workaround...
Unfortunately really fixing this doesn't look simple, we probably would
have to recreate the menu internally anyhow.
Another workaround when using XRC may be to specify a (dummy) bitmap for
the first menu item -- this will make all of the items owner drawn, as
explained above.
Finally we probably should have font/colour attributes for the menu items
in the XRC...
AO> BTW: Is there any chance to set fg/bg color for the toplevel menu label?
I don't think so, AFAIK Win32 API doesn't support this. So we'd have to stop
using the standard menu bar and do everything ourselves which isn't very
appealing.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list