Re: [gnome-love]Fixing dialog boxes



ERDI Gergo wrote:

On Fri, 20 Apr 2001, Federico Mena Quintero wrote:

      - Many dialog boxes lack underlined shortcuts in labels for
          text entries and similar widgets.  For example, you should
          have

              _Name [________________]

        so that you can hit Alt-N to go to that entry.  Push-buttons
        often lack such underlined shortcuts as well.

So how does one fix this? My initial guess was AccelLabel:
    Gtk::AccelLabel *label_widget = new Gtk::AccelLabel ("");

    label_widget->parse_uline ("_Foo");
    label_widget->set_alignment (1, 0.5);
    label_widget->set_accel_widget (control);

I don't know how to do it in  C++, in C it goes like this :
I hope this brings some light to the C++ case.

(taken from cvs/ghex/src/converter.c)

        GtkWidget *label;
        GtkWidget *entry;
        gint accel_key;

        /* label */
        label = gtk_label_new(name);
        gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
        gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, pos, pos+1);
        accel_key = gtk_label_parse_uline(GTK_LABEL(label), name);
        gtk_widget_show(label);

        /* entry */
        entry = gtk_entry_new();
        gtk_widget_add_accelerator(entry, "grab_focus", accel_group, accel_key,
                                           GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
        gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 2, pos, pos+1);
        gtk_widget_show(entry);
       

For libglade interfaces, setting an underline accelerator for a label sort
of works: sometimes (mostly for entries) it guesses the right widget to
focus, but sometimes nothing happens.

If you can figure out the cases in which nothing happens it will be
helpfull
so that we can track where the problem is. It can be a number of things,
a bug in libglade, a forgoten make install galde file ;-) etc.

love,
Chema




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