mnemonics, version 1.3.5



Hi,

I am in the process of porting an app from 1.2.10 to 1.3.5.  In my file
menu I have up to five menu items which represent the most recent used
files, like:
1. abc
2. def

And I have accelorators connected to the number. One of the problems I ran
into was when the label contained an underscore.  I was able to get around
this in 1.2 by doing something along the lines of:

   char *lbl = "1. abc_def";
   char *pat = "_         ";
   GtkAccelGroup *accels = gtk_menu_ensure_uline_accel_group(
                                             GTK_MENU(FileMenu));
        
   GtkWidget *histMenu = gtk_menu_item_new_with_label(lbl);
   gtk_label_set_pattern (GTK_LABEL (GTK_BIN (histMenu)->child), pat);
   guint accl_key = gdk_keyval_to_lower (lbl[0]);
   gtk_widget_add_accelerator (histMenu, "activate_item", accels,
                                     accl_key, 0, (GtkAccelFlags)0);

   gtk_signal_connect(GTK_OBJECT(histMenu), "activate",
                           GTK_SIGNAL_FUNC(recal_history),user_data);
...


My question is how to do this with the new mnemonics of 1.3.5, using 
gtk_label_new_with_mnemonic() results in the same problem I had before
when the label has underscores within it, and I only want the first one
used as a mnemonic.

Any suggestions on how I can get my current solution to work with the new
code would be appreciated.


Steve Ramsay




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