4.18. Focus Options
In an application, you can tab between widgets to make them available for input from the keyboard. The application indicates that a widget is available for keyboard input by drawing an outline around it in black (this is called the highlight rectangle; see Figure 4-37). If a widget has this outline around it, it is said to have the focus of the application. (You can force the focus of an application to start with a specific widget by using $widget->focus;.) Once a Button has the focus, you can use the spacebar on your keyboard to activate it instead of using the mouse.
Figure 4-37. The first Button has the input focus
-takefocus => 0 | 1 | undef
The -takefocus option is normally set to an empty string (undef), which allows the application to dynamically decide if the widget will accept focus. If a widget has its state set to 'disabled', it will be skipped over when users tab through all the widgets. To have the application always ignore the widget when tabbing through, use -takefocus => 0. To have the application always allow focus to the widget, use -takefocus => 1.
Copyright © 2002 O'Reilly & Associates. All rights reserved.