Re: Creating SubMenus



Nicolas Raitman wrote:

Hi,

NR> Hi to all. I know how t create menus and menuitems, but suppose I want to
NR> have the following structure.

NR> Edit
Font
Bold
Italic

NR> Do you understand? How can I do this? I know that I cannot do it with the
NR> ItemFactory, that's why I am doing it in the complex way, creating each
NR> thing, but I could not find out how to create a sub menu.

Submenus  are in fact just standards menu item, which you added a menu
to. So, you just need to create a menu:

font_menu = gtk_menu_new ();

Then create a menu_item;

font_item = gtk_menu_item_new_with_label ("Font");
gtk_widget_set_name (font_item, "font_item");
gtk_container_add (GTK_CONTAINER (edit_menu), font_item);
gtk_widget_show (font_item);

And finally attach font_menu to font_item:

gtk_menu_item_set_submenu (font_item, font_menu);

That's  very  easy  to  understand, IMHO. Note that I don't think it's
more difficult that using ItemFactory...

NR> Thanks a lot,
NR> Nicolas



bye,

--
mmenal
                                 ____               _    _                    _
         __  __ _ __  __  __    / ___| ___  _   _  | |  ( )_ __  _   ___  __ | |
(o-      \ \/ /(_)\ \/ /  _ \  | |  _ /'_ \| | | | | |  | | '_ \| | | \ \/ / | |
/\        \  / | | \  / | __/  | |_| | | | | |_| | | |__| | | | | |_| |>  <  |_|
L_/_       \/  |_|  \/  \___|  \_____|_| |_|\__,_/ |____|_|_| |_|\__,_/_/\_\ (_)


 
______________________________________________________________________________
Vous avez un site perso ?
2 millions de francs à gagner sur i(france) !
Webmasters : ZE CONCOURS ! http://www.ifrance.com/_reloc/concours.emailif






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