Widget.keynavFailed

bool keynavFailed(gtk.types.DirectionType direction)

Emits the ::keynav-failed signal on the widget.

This function should be called whenever keyboard navigation within a single widget hits a boundary.

The return value of this function should be interpreted in a way similar to the return value of [gtk.widget.Widget.childFocus]. When true is returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to. When false is returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling [gtk.widget.Widget.childFocus] on the widget’s toplevel.

The default signalGtk.Widget::keynav-failed handler returns false for [gtk.types.DirectionType.TabForward] and [gtk.types.DirectionType.TabBackward]. For the other values of [gtk.types.DirectionType] it returns true.

Whenever the default handler returns true, it also calls [gtk.widget.Widget.errorBell] to notify the user of the failed keyboard navigation.

A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of [gtk.entry.Entry] widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.

Parameters

directiondirection of focus movement

Returns

true if stopping keyboard navigation is fine, false

if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).