# Tab Navigation

DevFeed: [Tab Navigation](<https://devfeed.tech/articles/tab-navigation-22385.md>)

Original publisher: [Read original article](<https://www.red-lang.org/2023/11/tab-navigation.html>)

Author: Nenad Rakocevic (noreply@blogger.com)

Published: 2023-11-22T22:00:00Z

Content type: article

Language: en

Sources: [Red](<https://devfeed.tech/sources/red.md>)

Topics: [Red](<https://devfeed.tech/topics/red.md>), [GUI](<https://devfeed.tech/topics/gui.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [gui](<https://devfeed.tech/tags/gui.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [keyboard](<https://devfeed.tech/tags/keyboard.md>), [native](<https://devfeed.tech/tags/native.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [tabbing](<https://devfeed.tech/tags/tabbing.md>), [windows](<https://devfeed.tech/tags/windows.md>)

## AI overview

This article introduces tab navigation for Red's native GUI backends. It explains the mixed implementation, automatic forward and backward navigation, focusable flags, TAB-transparent faces, text-area behavior, and manual next/previous navigation overrides.

## Source excerpt

We finally got tab navigation implemented! You might think it should have been an easy feature to add, but achieving a consistent and controllable behavior across our different native GUI backends is not that straightforward. So we opted for a mixed implementation with a general high-level navigation layer in Red and left spatial navigation handling to each backend, in order to preserve the native behavior as much as possible. Automatic navigation By default, pressing TAB key will allow you to navigate to all the GUI widgets in a window, capable of acquiring the focus. Once the last widget is reached, the next TAB press will circle back to the first focusable widget. Conversely, back-navigation can be achieved using Shift-TAB key combination, circling from first face to last one. Here is a simple example: view [ text "Name" field focus return text "Surname" field return below check "Single" check "Employed" button "Send" ] Note: check-boxes selection/unselection is done using the Space key (default on Windows). It is possible to make a face "TAB-transparent", so that TAB navigation will skip it in both directions. This is achieved by removing the focusable flag from a navigable face. For example, in the following code, clicking on the "Click me!" button will toggle the button's focusable flag on and off (using set-flag/toggle): view [ text "Name" field focus return text "Surname" field return below check "Single" check "Employed" button "Send" button "Click me!" 100 [ face/text: pick ["TAB ignore" "TAB stop"] to-logic face/flags set-flag/toggle face 'focusable ] ] In case of area face, the default behavior for TAB navigation means that tab characters cannot be input in the area. In such cases, the alternative Ctrl-TAB key combination can be used to input tab characters. In case the focusable flag is removed from an area face, then TAB key will directly produce tab characters. Here is an example: view [ text "Name" field focus return text "Surname" field return below