Re: GtkOptionMenu menu is invisible



On Mon, Oct 15, 2001 at 11:02:00PM +0100, rob wrote:
Hi I'm haveing problems with GtkOptionMenu I'm trying to set the menu
that it pops up like so:

        newModeMenu = GTK_MENU(gtk_menu_new());
        for (i = 0; i < scaleType_get_noModes(scaleType); i++){
                gchar *modeName;
                GtkWidget *menuItem;

                modeName = scaleType_get_modeName(scaleType, i);
                menuItem = gtk_menu_item_new_with_label (modeName);
                gtk_menu_append(newModeMenu, menuItem);
                g_free (modeName);
        }

        modeOM = GTK_OPTION_MENU (lookup_widget (scaleWindow, 
                                                 "scaleModeOM"));
        gtk_option_menu_remove_menu(modeOM);    
        gtk_option_menu_set_menu (modeOM, GTK_WIDGET(newModeMenu));

And though it all seems to work,when the option menu is clicked no menu
is shown just a tiny little square.
I can call gtk_option_menu_get_menu look at the menu and it all seems
correct and the lable in the option menu itself is correct (it is the
first menu item.)
Am I doing something obviously wrong here?

  Yes. Since the menu is in its own window, the menu items have to be
shown individually. You need to issue a gtk_widget_show(menuItem); just
after the call to gtk_menu_append().

I tride sticking in a gtk_widget_show but it didn't help.

  Where and how did you try a gtk_widget_show()?

This is on debian potatoe with ximian gnome. The option menu is
orgionall created by glade.

  This shouldn't change anything.


      IHTH.

             DindinX

-- 
 David dindinx org



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