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

Re: How to change font of a menuItem?



Hi January

I think the problem is probably that you need to change 
the actual widget which is drawing the text. 
The menuitem probably contains a label of some kind which is 
doing the actual text.

I think you can probably use $mi->child to get the child
of the menu item, and then try using modify_font on that.

I've tried it out and it works for me.

eg 
if(defined($mI->child))
{
  $mI->child->modifyFont($testfont);
}

cheers,
Chris  


> 
> I create menu items using
> 
>   my $menu = Gtk2::Menu->new() ;
>   my $mI ;
> 
>   $mI = Gtk2::MenuItem( "blah") ;
>   $menu->append( $ml ) ;
> 
> How can I change the font of the menu item (specifically, I want to
> show some menu items in bold) later during the execution of the
> program?
> 
> I have tried the following, but without success:
> 
> my $testfont = Gtk2::Pango::FontDescription->new ;
> $testfont->set_weight( 'bold' ) ;
> $mI->modify_font( $testfont ) ;
> 
> Thanks!
> 
> j.
-- 


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