Re: Accelerator keys and popup menus? (Solved)



Hi,

Dunno if this is a bug/limmitation in gtk+. I now moved the GtkAccelGroup to my ui-resource singleton and it works. That means I use only *one* accel_group. I have a toplevel window with views (tabs). Before I was creating a separate one for my popup menu and adding/removing to the window depending on which tab was visible. Seems that gtk+ is only supporting one accel_group.

Stefan

Quoting Stefan Kost <ensonic hora-obscura de>:

hi,

Gabriel Schulhof wrote:
Hi!

On Sun, 2007-08-19 at 23:48 +0300, Stefan Kost wrote:
I read about the differences. I really want "accelerators".
I was able to hack it:

Create a plain old regular menubar-type menu with accelerators. Then ref
the submenu you want to make into a popup menu and detach it from its
parent menu item[0].

[0]http://library.gnome.org/devel/gtk/unstable/GtkMenuItem.html#id3734460

HTH,

Gabriel


like this?

// generate the context menu
GtkWidget *mb=gtk_menu_bar_new();
GtkWidget *mi=gtk_menu_item_new();
gtk_container_add(GTK_CONTAINER(mb),mi);

self->priv->context_menu=GTK_MENU(gtk_menu_new());
gtk_menu_set_accel_group(GTK_MENU(self->priv->context_menu),
  self->priv->accel_group);

gtk_menu_set_accel_path(GTK_MENU(self->priv->context_menu),"<Buzztard-Main>/PatternView/PatternContext");

gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi),GTK_WIDGET(self->priv->context_menu));
g_object_ref(self->priv->context_menu);
gtk_menu_detach(self->priv->context_menu);


make no difference for me :/

I also tried
gtk_menu_attach_to_widget(self->priv->context_menu,
  GTK_WIDGET (main_window),NULL);


Stefan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






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