Hi All, I am trying to add accelerators to menu items. But they don't seem to work as they should. There's a menuitem which when activated will hide the menu bar. But once the menu bar is hidden, none of the accelerators work. I am using Fedora Core. Any idea on what's going on here? Why are accelerators disabled when menu bar is hidden? How do I enable them? and what are the other workarounds? Suprisingly I don't face this problem on RedHatLinux-8 but only on FedoraCore.
Thanks Sample program is attached below: gboolean menuActive = TRUE; void print( GtkWidget *w , gpointer data) { g_print("Hi\n"); if (menuActive) gtk_widget_hide(GTK_WIDGET(data)); else gtk_widget_show(GTK_WIDGET(data)); } int main( int argc, char *argv[] ) { gtk_init (&argc, &argv); GtkWidget *w = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(w),100,100); GtkAccelGroup *gag = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(w),gag); GtkWidget *menu = gtk_menu_bar_new(); GtkWidget *submenu = gtk_menu_new(); GtkWidget *m1 = gtk_separator_menu_item_new(); GtkWidget *m2 = gtk_menu_item_new_with_label("View"); GtkWidget *m3 = gtk_separator_menu_item_new(); GtkWidget *m4 = gtk_menu_item_new_with_label("Tools"); GtkWidget *m5 = gtk_menu_item_new_with_label("File"); gtk_menu_shell_append(GTK_MENU_SHELL(submenu),m1); gtk_menu_shell_append(GTK_MENU_SHELL(submenu),m2); gtk_menu_shell_append(GTK_MENU_SHELL(submenu),m3); gtk_menu_shell_append(GTK_MENU_SHELL(menu),m4); gtk_menu_shell_append(GTK_MENU_SHELL(menu),m5); gtk_menu_item_set_submenu(GTK_MENU_ITEM(m4),submenu); g_signal_connect(G_OBJECT(m2),"activate",G_CALLBACK(print),menu); gtk_widget_add_accelerator(m2,"activate",gag,GDK_A,(GdkModifierType)0,GTK_ACCEL_VISIBLE); gtk_container_add(GTK_CONTAINER(w),menu); gtk_widget_show(m1); gtk_widget_show(m2); gtk_widget_show(m3); gtk_widget_show(m4); gtk_widget_show(m5); gtk_widget_show(menu); gtk_widget_show(submenu); gtk_widget_show(w); gtk_main(); return 0; } __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list