Re: how to set the font in a menu item




erik@netscape.com (Erik van der Poel) writes:

> Hello,
> 
> I'm trying to programmatically set the font of a menu item. I tried the
> following code:
> 
>   gtk_widget_ensure_style(mMenuItem);
>   GtkStyle* style = gtk_style_copy(mMenuItem->style);
>   gdk_font_unref (style->font);
>   GdkFont* font = gdk_font_load("fixed");
>   style->font = font;
>   gdk_font_ref(style->font);
>   gtk_widget_set_style(mMenuItem, style);
>   gtk_style_unref(style);
> 
> But it doesn't work.

The problem (I think) is that you are setting the font
on the MenuItem, not on the label that the MenuItem
contains.

The label is accessible as GTK_BIN (menuitem)->child.

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]