[gtkada] Underlined menu shortcuts

Larry Elmore ljelmore at home.com
Thu May 24 07:35:16 CEST 2001


I've got the underlined keyboard accelerators to work, but I still can't
get underlined letters to display in the menus. 

Here's the C code generated by glade for the first menu item:

  kon_tiki1 = gtk_menu_item_new_with_label ("");
  tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN
(kon_tiki1)->child),
                                   _("_KonTiki"));
  gtk_widget_add_accelerator (kon_tiki1, "activate_item", accel_group,
                              tmp_key, GDK_MOD1_MASK, (GtkAccelFlags)
0);
  gtk_widget_ref (kon_tiki1);
  gtk_object_set_data_full (GTK_OBJECT (window1), "kon_tiki1",
kon_tiki1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (kon_tiki1);
  gtk_container_add (GTK_CONTAINER (menubar1), kon_tiki1);

Here's the hand-modified Ada code generated by Glade:

   Gtk_New (Window1.Kon_Tiki1);              -- Originally: Gtk_New
(Window1.Kon_Tiki1, "_KonTiki");
   Set_Right_Justify (Window1.Kon_Tiki1, False);
   Parse_Uline (Gtk_Label (Gtk_Widget (Window1.Kon_Tiki1)),
"_KonTiki");  -- This line added
   Gtk_New (The_Accel_Group);
   Add_Accel_Group (Window1, The_Accel_Group);
   Add_Accelerator (Window1.Kon_Tiki1, "activate_item",
     The_Accel_Group, GDK_K, Gdk.Types.Mod1_Mask, Accel_Visible);
   Add (Window1.Menubar1, Window1.Kon_Tiki1);

This code compiles fine, but when run gives:

   raised STORAGE_ERROR : stack overflow (or erroneous memory access)

It's definitely the Parse_Uline() that causes the crash -- take it out
and it runs fine, but the menu has "_KonTiki" displayed.

Does anyone have any ideas on what I'm doing wrong here? I'm about to
give up on getting this feature to work at all...

Larry



More information about the gtkada mailing list