Change fg/bg Colour for menu items [MSW2.9]
Andreas Oppermann
Andreas-Oppermann at oss-gmbh.de
Sat Nov 3 02:11:07 PDT 2007
I played around in the ownerdrw.cpp sample and found out that
only during creation you have to specify the attribute "IsOwnerDrawn"
because there is a different handling:
"wx/src/msw/menu.cpp"
// append a new item or submenu to the menu
bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
.....
if ( !pItem->IsOwnerDrawn() && !pItem->IsSeparator() )
.....
if ( pItem->IsOwnerDrawn() )
.....
In my case (loading complete menu tree during XRC) all the insertation is
done.
My solution is to create a new menutree with the existing items but
including the different color setting.
BTW: Is there any chance to set fg/bg color for the toplevel menu label?
Best and THX to Vadim,
Andreas Oppermann
"Vadim Zeitlin" <vadim at wxwidgets.org> schrieb im Newsbeitrag
news:R4bbVC.A.PUF.INjKHB at brage.sunsite.dk...
> On Thu, 1 Nov 2007 10:42:29 +0100 Andreas Oppermann
> <Andreas-Oppermann at oss-gmbh.de> wrote:
>
> AO> I also added the font setting to my menuitem changes.
> AO> Unfortunately no effect.
> AO> When I am looking at the sample the menu item is added to the menu
> after
> AO> setting the attributs.
>
> There must be something else because I've just tried this patch
>
> Index: samples/ownerdrw/ownerdrw.cpp
> ===================================================================
> --- samples/ownerdrw/ownerdrw.cpp (revision 49505)
> +++ samples/ownerdrw/ownerdrw.cpp (working copy)
> @@ -161,8 +161,6 @@
>
> pItem = new wxMenuItem(file_menu, Menu_Bitmap, _T("&Bell"),
> _T("check/uncheck me!"), wxITEM_CHECK);
> - pItem->SetFont(fontBmp);
> - pItem->SetBitmaps(bmpBell);
> file_menu->Append(pItem);
>
> pItem = new wxMenuItem(file_menu, Menu_Bitmap2, _T("So&und"),
> @@ -202,6 +200,10 @@
>
> menu_bar->Append(file_menu, _T("&File"));
> SetMenuBar(menu_bar);
> +
> + pItem = menu_bar->FindItem(Menu_Bitmap);
> + pItem->SetFont(fontBmp);
> + pItem->SetBitmaps(bmpBell);
> }
>
> // main frame constructor
>
> and it still works for me.
>
> Please try to reproduce the problem in the sample (with minimal changes).
>
> Regards,
> VZ
>
> --
> TT-Solutions: wxWidgets consultancy and technical support
> http://www.tt-solutions.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
More information about the wx-users
mailing list