1widget(n) Tile Widget Set widget(n)
2
3
4
6 widget - Standard options and commands supported by Tile widgets
7
9 This manual describes common widget options and commands.
10
12 The following options are supported by all Tile widgets: [-class (N/A)]
13 Specifies the window class. The class is used when querying the option
14 database for the window's other options, to determine the default bind‐
15 tags for the window, and to select the widget's default layout and
16 style. This is a read-only option: it may only be specified when the
17 window is created, and may not be changed with the configure widget
18 command. [-cursor cursor] Specifies the mouse cursor to be used for
19 the widget. See Tk_GetCursor and cursors(n) in the Tk reference manual
20 for the legal values. If set to the empty string (the default), the
21 cursor is inherited from the parent widget. [-takefocus takeFocus]
22 Determines whether the window accepts the focus during keyboard traver‐
23 sal. Either 0, 1, a command prefix (to which the widget path is
24 appended, and which should return 0 or 1), or the empty string. See
25 options(n) in the Tk reference manual for the full description.
26 [-style style] May be used to specify a custom widget style.
27
29 The following options are supported by widgets that are controllable by
30 a scrollbar. See scrollbar(n) for more information [-xscrollcom‐
31 mand xScrollCommand] A command prefix, used to communicate with hori‐
32 zontal scrollbars.
33 When the view in the widget's window changes, the widget will generate
34 a Tcl command by concatenating the scroll command and two numbers.
35 Each of the numbers is a fraction between 0 and 1 indicating a position
36 in the document; 0 indicates the beginning, and 1 indicates the end.
37 The first fraction indicates the first information in the widget that
38 is visible in the window, and the second fraction indicates the infor‐
39 mation just after the last portion that is visible.
40 Typically the xScrollCommand option consists of the path name of a
41 scrollbar widget followed by ``set'', e.g. ``.x.scrollbar set''. This
42 will cause the scrollbar to be updated whenever the view in the window
43 changes.
44 If this option is set to the empty string (the default), then no com‐
45 mand is be executed. [-yscrollcommand yScrollCommand] A command pre‐
46 fix, used to communicate with vertical scrollbars. See the description
47 of -xscrollcommand above for details.
48
50 The following options are supported by labels, buttons, and other but‐
51 ton-like widgets: [-text text] Specifies a text string to be displayed
52 inside the widget (unless overridden by -textvariable). [-textvari‐
53 able textVariable] Specifies the name of variable whose value will be
54 used in place of the -text resource. [-underline underline] If set,
55 specifies the integer index (0-based) of a character to underline in
56 the text string. The underlined character is used for mnemonic activa‐
57 tion (see keynav(n)). [-image image] Specifies an image to display.
58 This is a list of 1 or more elements. The first element is the default
59 image name. The rest of the list is a sequence of statespec / value
60 pairs as per style map, specifying different images to use when the
61 widget is in a particular state or combination of states. All images
62 in the list should have the same size. [-compound compound] Specifies
63 how to display the image relative to the text, in the case both -text
64 and -image are present. Valid values are:
65
66 text Display text only.
67
68 image Display image only.
69
70 center Display text centered on top of image.
71
72 top
73
74 bottom
75
76 left
77
78 right Display image above, below, left of, or right of the
79 text, respectively.
80
81 none The default; display the image if present, otherwise the
82 text.
83 [-width width] If greater than zero, specifies how much space, in char‐
84 acter widths, to allocate for the text label. If less than zero, spec‐
85 ifies a minimum width. If zero or unspecified, the natural width of
86 the text label is used.
87
88
90 [-state state] May be set to normal or disabled to control the disabled
91 state bit. This is a ``write-only'' option: setting it changes the
92 widget state, but the state widget command does not affect the state
93 option.
94
95
97 pathName cget option
98 Returns the current value of the configuration option given by
99 option.
100
101 pathName configure ?option? ?value option value ...?
102 Query or modify the configuration options of the widget. If one
103 or more option-value pairs are specified, then the command modi‐
104 fies the given widget option(s) to have the given value(s); in
105 this case the command returns an empty string. If option is
106 specified with no value, then the command returns a list
107 describing the named option: the elements of the list are the
108 option name, database name, database class, default value, and
109 current value. If no option is specified, returns a list
110 describing all of the available options for pathName.
111
112 pathName instate statespec ?script?
113 Test the widget's state. If script is not specified, returns 1
114 if the widget state matches statespec and 0 otherwise. If
115 script is specified, equivalent to if {[pathName instate state‐
116 Spec]} script.
117
118 pathName state ?stateSpec
119 Modify or inquire widget state. If stateSpec is present, sets
120 the widget state: for each flag in stateSpec, sets the corre‐
121 sponding flag or clears it if prefixed by an exclamation point.
122 Returns a new state spec indicating which flags were changed:
123 pathName state $changes'' will restore pathName to the original
124 state. If stateSpec is not specified, returns a list of the
125 currently-enabled state flags.
126
128 The widget state is a bitmap of independent state flags. Widget state
129 flags include:
130
131 active The mouse cursor is over the widget and pressing a mouse button
132 will cause some action to occur. (aka "prelight" (Gnome), "hot"
133 (Windows), "hover").
134
135 disabled
136 Widget is disabled under program control (aka "unavailable",
137 "inactive")
138
139 focus Widget has keyboard focus
140
141 pressed
142 Widget is being pressed (aka "armed" in Motif).
143
144 selected
145 "On", "true", or "current" for things like checkbuttons and
146 radiobuttons.
147
148 background
149 Windows and the Mac have a notion of an "active" or foreground
150 window. The background state is set for widgets in a background
151 window, and cleared for those in the foreground window.
152
153 readonly
154 Widget should not allow user modification.
155
156 alternate
157 A widget-specific alternate display format. For example, used
158 for checkbuttons and radiobuttons in the "tristate" or "mixed"
159 state, and for buttons with -default active.
160
161 invalid
162 The widget's value is invalid. (Potential uses: scale widget
163 value out of bounds, entry widget value failed validation.)
164
165 A state specification or stateSpec is a list of state names, optionally
166 prefixed with an exclamation point (!) indicating that the bit is off.
167
169 set b [ttk::button .b]
170
171 # Disable the widget: $b state disabled
172
173 # Invoke the widget only if it is currently pressed and enabled: $b
174 instate {pressed !disabled} { .b invoke }
175
176 # Reenable widget: $b state !disabled
177
179 tile-intro(n), style(n)
180
182 state, configure, option
183
184
185
186tile 0.2 widget(n)