Tooltips and sub-menus



If I create a menu bar with items that do not have sub-menus, tooltips appear 
correctly for these items.  However, if an item on the menu bar is assigned a 
sub-menu, the tooltip for the item on the menu bar no longer appears.

If lines 22-24 are commented out in the attached code section, the tooltip for 
'help_item' appears as expected (but the sub-menu doesn't appear).  With 
these lines included, the tooltip for 'help_item' no longer appears, but the 
tooltips for 'help_menu_item[12]' appear as expected.

Is it possible to define a tooltip for an item on the menu bar if it has a 
sub-menu?  I am using gtk+-2.2.2.

 1 /* Create menu bar */
 2   menu_bar = gtk_menu_bar_new( );
 3
 4 /* Create help_item & its sub-menu */
 5   help_item = gtk_menu_item_new_with_label( "Help 1" );
 6   help_menu = gtk_menu_new();
 7     help_menu_item1 = gtk_menu_item_new_with_label( "Help 2" );
 8     help_menu_item2 = gtk_menu_item_new_with_label( "Help 3" );
 9
10 /* Create Tooltips */
11   tooltips = gtk_tooltips_new( );
12
13 /* Define Tooltips */
14   gtk_tooltips_set_tip( tooltips, help_item, "Tip 1", NULL );
15   gtk_tooltips_set_tip( tooltips, help_menu_item1, "Tip 2", NULL );
16   gtk_tooltips_set_tip( tooltips, help_menu_item2, "Tip 3", NULL );
17
18 /* Pack Menu Bar */
19   gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), help_item );
20
21 /* Attach and pack the menus */
22   gtk_menu_item_set_submenu( GTK_MENU_ITEM( help_item ), help_menu );
23   gtk_menu_append( GTK_MENU(help_menu), help_menu_item1 );
24   gtk_menu_append( GTK_MENU(help_menu), help_menu_item2 );



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