Problem in underline accelerator gtk1.2



I'm trying to implement underline and shortcut accelerator on a gtk1.2 application. After compilation shortcut accelerator works fine but when i run the program and press 'F' for "_File", the pulldown menu for File doesn't come up. I can see the underline beneath the letter 'F' though. Can anyone kindly give insight about what I am doin' wrong? Thanks.




  GtkWidget *file_menu_item, *exit_item, *help_menu_item, *about_item;
  GtkAccelGroup *accel_group, *file_accel_group, *help_accel_group;
  guint key_file, key_exit, key_help, key_about;

  .........
  file_menu_item = gtk_menu_item_new_with_label("");
  exit_item = gtk_menu_item_new_with_label("");

  help_menu_item = gtk_menu_item_new_with_label("");
  about_item = gtk_menu_item_new_with_label("");
  ........

  accel_group = gtk_accel_group_new();
  gtk_accel_group_attach(accel_group, GTK_OBJECT(top_window));


file_accel_group = gtk_menu_ensure_uline_accel_group(GTK_MENU(file_menu)); help_accel_group = gtk_menu_ensure_uline_accel_group(GTK_MENU(help_menu));


key_file = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(file_menu_item)->child), "_File"); key_exit = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(exit_item)->child), "_Exit"); key_help = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(help_menu_item)->child), "_Help"); key_about = gtk_label_parse_uline(GTK_LABEL(GTK_BIN(about_item)->child), "_About Us");

  ........

gtk_widget_add_accelerator(exit_item, "activate", accel_group, 'Q', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(about_item, "activate", accel_group, 'A', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);


gtk_widget_add_accelerator(file_menu_item, "activate", file_accel_group, key_file, GDK_NONE, GDK_NONE); gtk_widget_add_accelerator(exit_item, "activate", file_accel_group, key_exit, GDK_NONE, GDK_NONE); gtk_widget_add_accelerator(help_menu_item, "activate", help_accel_group, key_help, GDK_NONE, GDK_NONE); gtk_widget_add_accelerator(about_item, "activate", help_accel_group, key_about, GDK_NONE, GDK_NONE);

  ........

_________________________________________________________________
Don?t waste time standing in line?try shopping online. Visit Sympatico / MSN Shopping today! http://shopping.sympatico.msn.ca




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