at_tab - changes widget focus
SYNOPSIS
source at\$tk_include:at_defs.atk
at_tab entrylist
ARGUMENTS
- entrylist
- A list of text entry widgets that the focus will move about.
The list should be in the order of progression.
DESCRIPTION
This procedure is part of the standard AT_DEFS
. It allows
the programmer to cuase the focus of text widgets to be moved to the next
logical text widget. This could be implemented as the command associated with
a binding when defining a text widget. For reasons of style, we recommend
using the key to do this, but it may be conceivable to bind other keys
(e.g. in a "form" situation).
Example
Here is some example code that can be used to create a text widget, add a
binding to the key which calls the at_tab command. At the risk of
making the example slightly complicated, I've ensured that the code here is
complete in its own right.
#+
# Title Demo
#
# Function Demonstrates the "at_tab" procedure.
#
# Author Derek McKay
# Date 1-Dec-1994
#-
source at\$tk_include:at_defs.atk
#+
# Routine make_entry
# Function This procedure makes a text entry widget given a widget
# name and a label as arguments. It binds and .
#
# Author Derek McKay
# Date 1-Dec-1994
#
# Call
proc make_entry {widget label} {
global entrylist
#-
frame .$widget
pack .$widget -side top
entry .$widget.entry -width 12 -relief sunken -width 16
label .$widget.label -text "$label:" -width 16
pack .$widget.entry -side right -in .$widget\
-anchor e
pack .$widget.label -side left -in .$widget\
-anchor w
bind .$widget.entry \
"puts stdout \"Widget($widget) returned \[.$widget.entry get\]\""
bind .$widget.entry "at_tab \$entrylist"
lappend entrylist ".$widget.entry"
}
make_entry ra "Right Ascension"
make_entry dec Declination
make_entry az Azimuth
make_entry el Elevation
button .quit -text Quit -command exit -fg red
pack .quit -side bottom -expand yes -fill x
#EOF
When you run the script, try typing text, numbers <Tab>s and
<Returns>s in the various text boxes.
KEYWORDS
ATwish, binding, focus, procedure
Original: dmckay (1-DEC-1994)
Modified: dmckay (17-JUL-1995)