Beleagered By Button Behavior Blues



I have two areas that I display text entries and a couple of buttons,
one of which I want to be the default.

One area is a dialog, with three text entries and two buttons, 'Save'
and 'Cancel'.

The other is basically the same, but not in a dialog box - the text
entries and buttons are packed in a table.

In either case, the problem is that if I get the first text entry to
grab focus, the dotted-line visual cue on the default button goes away,
so the user doesn't know what will happen if they press 'Enter'.  Even
if the button has the default action, i.e. if the user presses Enter the
button action is invoked, I'd like to make it apparent that the button
is the default.

Here's what I've tried:
In the dialog, after loading the entries,

        gtk_widget_grab_focus(name_entry);
        gtk_dialog_set_default_response(GTK_DIALOG(dialog),
                                        GTK_RESPONSE_ACCEPT);
        gtk_widget_show_all(dialog);
        result = gtk_dialog_run (GTK_DIALOG (dialog));

And in the table-based entries with buttons:

        gtk_widget_grab_focus(exec_entry);
        gtk_widget_show(GTK_WIDGET(env_save_btn));// buttons were hidden
        gtk_widget_show(GTK_WIDGET(env_cncl_btn));
        gtk_widget_grab_default(GTK_WIDGET(env_save_btn));

Although I haven't looked at the source, it appears as though setting
default to a button is akin to giving it the focus, which precludes
anything else from having focus.  However, in the above example I give
focus to an entry and then set default to the button.  The entry indeed
keeps the focus, but the button loses the highlighted visual cue (dotted
line frame around button label).
If I don't try to give the entry focus, the defaulted button looks
correct (has the cue).

I think what I'm trying to do is a fairly common, conventional and
HIG-compliant interface behavior - is there a trick to achieving it?

Thanks,
Don







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