Changing tab order

Hi,
When tabbing thru a dialog, the buttons gets hit too.

How can i change the tab order or tell that a particular button must not get the focus, when tabbing thru the dialog?

BR Thomas

Hi, could you provide a little more context around what you’re trying to do? Making a button inaccessible with keyboard sounds like an unusual approach.

Hello.

I have a dialog with some gtk-entries and buttons.
The user tabs thru the dialog, and enters data.
If there is buttons among the gtk-entries, the user has to tab another time, to get to the next gtk-entry. I think that will be irritating for “him”.

The buttons can still be activated with the mouse or a shortcut.

BR Thomas

Refer https://docs.gtk.org/gtk4/input-handling.html#keyboard-input.

Thanks, sorry, i forgot i use gtk3 :expressionless:

Found the same page under gtk3 docs, but nothing about the tab-order.

If i remove the focus on a button, then of-course it would work, but then the downside is, that clicking the button wouldn’t work.

BR Thomas

I think you’ll have to either live with some “excess” tabbing, or group all the buttons together above/below the entries in question. The buttons have to be keyboard focusable somehow, since not everyone might be physically able to use a pointing device.

If there are a lot of entries in the app that will frequently be filled out in a repetitive fashion, you might want to consider having a non-tab key combination that focuses the next entry specifically (e.g. Enter, Ctrl+Enter, or Alt+right arrow). By doing this, you could even add convenience behavior such as Ctrl+Enter moving the keyboard focus to the next empty entry.

Thanks, i will group the bottons together instead.

Just wanted to know if changing the tab-order was possible in GTK, like it is in VC/MFC and QT.

BR Thomas

Hi,

Try to look at this: Gtk.Widget.child_focus

But no idea how to override the behavior… Maybe by catching the Gtk.Widget::focus signal from the container?

Thanks :slight_smile:

Nice to hear it’s possible in GTK also, but looks a bit tricky.

At the moment, i’ve grouped the buttons together, in their own area in the window.

BR Thomas