| 1 |
# Copyright (c) 1990-1994 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1997 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# |
| 7 |
|
| 8 |
=head1 NAME |
| 9 |
|
| 10 |
Tk::Widget - Base class of all widgets |
| 11 |
|
| 12 |
=for pm Tk/Widget.pm |
| 13 |
|
| 14 |
=for category Tk Generic Methods |
| 15 |
|
| 16 |
=head1 SYNOPSIS |
| 17 |
|
| 18 |
package Tk::Whatever; |
| 19 |
require Tk::Widget; |
| 20 |
@ISA = qw(Tk::Widget); |
| 21 |
Construct Tk::Widget 'Whatever'; |
| 22 |
|
| 23 |
sub Tk_cmd { \&Tk::whatever } |
| 24 |
|
| 25 |
S< >I<$widget>-E<gt>I<method>(?I<arg, arg, ...>?) |
| 26 |
|
| 27 |
=head1 DESCRIPTION |
| 28 |
|
| 29 |
The B<Tk::Widget> is an abstract base class for all Tk widgets. |
| 30 |
|
| 31 |
Generic methods available to all widgets include the methods based on core |
| 32 |
C<winfo> mechanism and are used to retrieve information about windows managed by |
| 33 |
Tk. They can take any of a number of different forms, depending on the I<method>. |
| 34 |
The legal forms are: |
| 35 |
|
| 36 |
=over 4 |
| 37 |
|
| 38 |
=item I<$widget>-E<gt>B<appname>?(I<newName>)? |
| 39 |
|
| 40 |
If I<newName> isn't specified, this method returns the name |
| 41 |
of the application (the name that may be used in B<send> |
| 42 |
commands to communicate with the application). |
| 43 |
If I<newName> is specified, then the name of the application |
| 44 |
is changed to I<newName>. |
| 45 |
If the given name is already in use, then a suffix of the form |
| 46 |
``B< #2>'' or ``B< #3>'' is appended in order to make the name unique. |
| 47 |
The method's result is the name actually chosen. |
| 48 |
I<newName> should not start with a capital letter. |
| 49 |
This will interfere with L<option|Tk::option> processing, since names starting with |
| 50 |
capitals are assumed to be classes; as a result, Tk may not |
| 51 |
be able to find some options for the application. |
| 52 |
If sends have been disabled by deleting the B<send> command, |
| •53 |
this command will re-enable them and recreate the B<send> |
| 54 |
command. |
| 55 |
|
| 56 |
=item I<$widget>-E<gt>B<atom>(I<name>) |
| 57 |
|
| 58 |
Returns a decimal string giving the integer identifier for the |
| 59 |
atom whose name is I<name>. If no atom exists with the name |
| 60 |
I<name> then a new one is created. |
| 61 |
|
| 62 |
=item I<$widget>-E<gt>B<atomname>(I<id>) |
| 63 |
|
| 64 |
Returns the textual name for the atom whose integer identifier is |
| 65 |
I<id>. |
| 66 |
This command is the inverse of the I<$widget>-E<gt>B<atom> command. |
| 67 |
It generates an error if no such atom exists. |
| 68 |
|
| 69 |
=item I<$widget>-E<gt>B<bell>( ?-nice? ); |
| 70 |
|
| 71 |
This command rings the bell on the display for I<$widget> and |
| 72 |
returns an empty string. |
| 73 |
The command uses the current bell-related settings for the display, which |
| 74 |
may be modified with programs such as B<xset>. |
| 75 |
|
| 76 |
If I<-nice> is not specified, this command also resets the screen saver |
| 77 |
for the screen. Some screen savers will ignore this, but others will |
| 78 |
reset so that the screen becomes visible again. |
| 79 |
|
| 80 |
=item I<$widget>-E<gt>B<bindDump> |
| 81 |
|
| 82 |
This command returns a list of strings suitable for printing detailing |
| 83 |
binding information for a widget. It prints a widget's |
| 84 |
bindtags. For each binding tag it prints all the bindings, comprised |
| 85 |
of the event descriptor and the callback. Callback arguments are |
| 86 |
printed, and B<Tk::Ev> objects are expanded. |
| 87 |
|
| 88 |
=item I<$widget>-E<gt>B<Busy>?(?-recurse => 1?,I<-option> => I<value>?)? |
| 89 |
|
| 90 |
This method B<configure>s a B<-cursor> option for I<$widget> and |
| 91 |
(if B<-recurse => 1> is specified) all its descendants. The cursor to |
| 92 |
be set may be passed as S<B<-cursor> => I<cursor>> or defaults to 'watch'. |
| 93 |
Additional B<configure> options are applied to I<$widget> only. |
| 94 |
It also adds a special tag B<'Busy'> to the B<bindtags> of the widgets so |
| 95 |
configured so that B<KeyPress>, B<KeyRelease>, B<ButtonPress> and |
| 96 |
B<ButtonRelease> events are ignored (with press events generating a call to |
| 97 |
B<bell>). It then acquires a local B<grab> for I<$widget>. |
| 98 |
The state of the widgets and the grab is restored by a call to |
| 99 |
I<$widget>-E<gt>B<Unbusy>. |
| 100 |
|
| 101 |
=item I<$widget>-E<gt>B<caret>( ?-x => I<x>?, ?-y => I<y>?, ?-height |
| 102 |
=> I<height>? ); |
| 103 |
|
| 104 |
Sets and queries the caret location for the display of the specified |
| 105 |
Tk window window. The caret is the per-display cursor location used |
| 106 |
for indicating global focus (e.g. to comply with Microsoft |
| 107 |
Accessibility guidelines), as well as for location of the |
| 108 |
over-the-spot XIM (X Input Methods) or Windows IME windows. If no |
| 109 |
options are specified, the last values used for setting the caret are |
| 110 |
return in option-value pair format. -x and -y represent |
| 111 |
window-relative coordinates, and -height is the height of the current |
| 112 |
cursor location, or the height of the specified window if none is |
| 113 |
given. |
| 114 |
|
| 115 |
=item I<$widget>-E<gt>B<cells> |
| 116 |
|
| 117 |
Returns a decimal string giving the number of cells in the |
| 118 |
color map for I<$widget>. |
| 119 |
|
| 120 |
=item I<$widget>-E<gt>B<children> |
| 121 |
|
| 122 |
I<$widget->>B<children> |
| 123 |
Returns a list containing all the children |
| 124 |
of $widget. The list is in stacking order, with the lowest |
| 125 |
window first. Top-level windows are returned as children |
| 126 |
of their logical parents. |
| 127 |
|
| 128 |
=item I<$widget>-E<gt>B<class> |
| 129 |
|
| 130 |
Returns the class name for I<$widget>. |
| 131 |
|
| 132 |
=item I<$widget>-E<gt>B<colormapfull> |
| 133 |
|
| 134 |
Returns 1 if the colormap for I<$widget> is known to be full, 0 |
| 135 |
otherwise. The colormap for a window is ``known'' to be full if the last |
| 136 |
attempt to allocate a new color on that window failed and this |
| 137 |
application hasn't freed any colors in the colormap since the |
| 138 |
failed allocation. |
| 139 |
|
| 140 |
=item I<$widget>-E<gt>B<ConfigSpecs> |
| 141 |
|
| 142 |
Used to perform delegated option configuration for a mega-widget. |
| 143 |
Returns, in Tk::Derived::ConfigSpecs notation (see L<Tk::ConfigSpecs>), |
| 144 |
all possible options for a widget. For example, |
| 145 |
|
| 146 |
$s = $self->Scale; |
| 147 |
$self->ConfigSpecs( |
| 148 |
$s->ConfigSpecs, |
| 149 |
.... more ConfigSpecs specifications |
| 150 |
); |
| 151 |
|
| 152 |
returns a hash of all Tk::Scale options, delegated to $s - e.g. some |
| 153 |
representative examples: |
| 154 |
|
| 155 |
-bigincrement => [$s, bigIncrement, BigIncrement, 0, 0] |
| 156 |
-digits => [$s, digits, Digits, 0, 0] |
| 157 |
-sliderlength => [$s, sliderLength, SliderLength, 10m, 30] |
| 158 |
-troughcolor => [$s, troughColor, Background, #c3c3c3, #c3c3c3] |
| 159 |
|
| 160 |
This provides an easy means of populating a mega-widget's ConfigSpecs |
| 161 |
with initializers. |
| 162 |
|
| 163 |
=item I<$widget>-E<gt>B<containing>(I<rootX,rootY>) |
| 164 |
|
| 165 |
Returns the window containing the point given |
| 166 |
by I<rootX> and I<rootY>. |
| 167 |
I<RootX> and I<rootY> are specified in screen units (i.e. |
| 168 |
any form acceptable to B<Tk_GetPixels>) in the coordinate |
| 169 |
system of the root window (if a virtual-root window manager is in |
| 170 |
use then the coordinate system of the virtual root window is used). |
| 171 |
If no window in this application contains the point then an empty |
| 172 |
string is returned. |
| 173 |
In selecting the containing window, children are given higher priority |
| 174 |
than parents and among siblings the highest one in the stacking order is |
| 175 |
chosen. |
| 176 |
|
| 177 |
=item I<$widget>-E<gt>B<depth> |
| 178 |
|
| 179 |
Returns a decimal string giving the depth of I<$widget> (number |
| 180 |
of bits per pixel). |
| 181 |
|
| 182 |
=item I<$widget>-E<gt>B<destroy> |
| 183 |
|
| 184 |
This command deletes the window related to |
| 185 |
I<$widget>, plus all its descendants. |
| 186 |
If all the B<MainWindows> are deleted then the entire application |
| 187 |
will be destroyed. |
| 188 |
|
| 189 |
The perl object I<$widget> continues to exist while references |
| 190 |
to it still exist, e.g. until variable goes out of scope. |
| 191 |
However any attempt to use Tk methods on the object will fail. |
| 192 |
B<Exists>(I<$widget>) will return false on such objects. |
| 193 |
|
| 194 |
Note however that while a window exists for I<$widget> the |
| 195 |
perl object is maintained (due to "references" in perl/Tk internals) |
| 196 |
even though original variables may have gone out of scope. |
| 197 |
(Normally this is intuitive.) |
| 198 |
|
| 199 |
=item B<Exists>(I<$widget>) |
| 200 |
|
| 201 |
Returns 1 if there exists a window for I<$widget>, 0 if no such |
| 202 |
window exists. |
| 203 |
|
| 204 |
=item I<$widget>-E<gt>B<font>(I<option>?, I<arg, arg, ...>?) |
| 205 |
|
| 206 |
Create and inspect fonts. See L<Tk::Font> for further details. |
| 207 |
|
| 208 |
=item I<$widget>-E<gt>B<fpixels>(I<number>) |
| 209 |
|
| 210 |
Returns a floating-point value giving the number of pixels |
| 211 |
in I<$widget> corresponding to the distance given by I<number>. |
| 212 |
I<Number> may be specified in any of the forms acceptable |
| 213 |
to B<Tk_GetScreenMM>, such as ``2.0c'' or ``1i''. |
| 214 |
The return value may be fractional; for an integer value, use |
| 215 |
I<$widget>-E<gt>B<pixels>. |
| 216 |
|
| 217 |
=item I<$widget>-E<gt>B<Getimage>(I<name>) |
| 218 |
|
| 219 |
Given I<name>, look for an image file with that base name and return |
| 220 |
a L<Tk::Image>. File extensions are tried in this order: F<xpm>, |
| 221 |
F<gif>, F<ppm>, F<xbm> until a valid iamge is found. If no image is |
| 222 |
found, try a builtin image with that name. |
| 223 |
|
| 224 |
=item I<$widget>-E<gt>B<geometry> |
| 225 |
|
| 226 |
Returns the geometry for I<$widget>, in the form |
| 227 |
I<width>B<x>I<height>B<+>I<x>B<+>I<y>. All dimensions are |
| 228 |
in pixels. |
| 229 |
|
| 230 |
=item I<$widget>-E<gt>B<height> |
| 231 |
|
| 232 |
Returns a decimal string giving I<$widget>'s height in pixels. |
| 233 |
When a window is first created its height will be 1 pixel; the |
| 234 |
height will eventually be changed by a geometry manager to fulfill |
| 235 |
the window's needs. |
| 236 |
If you need the true height immediately after creating a widget, |
| 237 |
invoke B<update> to force the geometry manager to arrange it, |
| 238 |
or use I<$widget>-E<gt>B<reqheight> to get the window's requested height |
| 239 |
instead of its actual height. |
| 240 |
|
| 241 |
=item I<$widget>-E<gt>B<id> |
| 242 |
|
| 243 |
Returns a hexadecimal string giving a low-level platform-specific |
| 244 |
identifier for $widget. On Unix platforms, this is the X |
| 245 |
window identifier. Under Windows, this is the Windows |
| 246 |
HWND. On the Macintosh the value has no meaning outside Tk. |
| 247 |
|
| 248 |
=item I<$widget>-E<gt>B<idletasks> |
| 249 |
|
| 250 |
One of two methods which are used to bring the application ``up to date'' |
| 251 |
by entering the event loop repeated until all pending events |
| 252 |
(including idle callbacks) have been processed. |
| 253 |
|
| 254 |
If the B<idletasks> method is specified, then no new events or errors |
| 255 |
are processed; only idle callbacks are invoked. This causes operations |
| 256 |
that are normally deferred, such as display updates and window layout |
| 257 |
calculations, to be performed immediately. |
| 258 |
|
| 259 |
The B<idletasks> command is useful in scripts where changes have been |
| 260 |
made to the application's state and you want those changes to appear |
| 261 |
on the display immediately, rather than waiting for the script to |
| 262 |
complete. Most display updates are performed as idle callbacks, so |
| 263 |
B<idletasks> will cause them to run. However, there are some kinds of |
| 264 |
updates that only happen in response to events, such as those |
| 265 |
triggered by window size changes; these updates will not occur in |
| 266 |
B<idletasks>. |
| 267 |
|
| 268 |
=item I<$widget>-E<gt>B<interps> |
| 269 |
|
| 270 |
Returns a list whose members are the names of all Tcl interpreters |
| 271 |
(e.g. all Tk-based applications) currently registered for |
| 272 |
a particular display. |
| 273 |
The return value refers |
| 274 |
to the display of I<$widget>. |
| 275 |
|
| 276 |
=item I<$widget>-E<gt>B<ismapped> |
| 277 |
|
| 278 |
Returns B<1> if I<$widget> is currently mapped, B<0> otherwise. |
| 279 |
|
| 280 |
=item I<$widget->>B<lower>(?I<belowThis>?) |
| 281 |
|
| 282 |
If the I<belowThis> argument is omitted then the command lowers |
| 283 |
$widget so that it is below all of its siblings in the stacking |
| 284 |
order (it will be obscured by any siblings that overlap it and |
| 285 |
will not obscure any siblings). |
| 286 |
If I<belowThis> is specified then it must be the path name of |
| 287 |
a window that is either a sibling of $widget or the descendant |
| 288 |
of a sibling of $widget. |
| 289 |
In this case the B<lower> command will insert |
| 290 |
$widget into the stacking order just below I<belowThis> |
| 291 |
(or the ancestor of I<belowThis> that is a sibling of $widget); |
| 292 |
this could end up either raising or lowering $widget. |
| 293 |
|
| 294 |
=item I<$widget>-E<gt>B<MapWindow> |
| 295 |
|
| 296 |
Cause I<$widget> to be "mapped" i.e. made visible on the display. |
| 297 |
May confuse the geometry manager (pack, grid, place, ...) |
| 298 |
that thinks it is managing the widget. |
| 299 |
|
| 300 |
=item I<$widget>-E<gt>B<manager> |
| 301 |
|
| 302 |
Returns the name of the geometry manager currently |
| 303 |
responsible for I<$widget>, or an empty string if I<$widget> |
| 304 |
isn't managed by any geometry manager. |
| 305 |
The name is usually the name of the method for the geometry |
| 306 |
manager, such as B<pack> or B<place>. |
| 307 |
If the geometry manager is a widget, such as canvases or text, the |
| 308 |
name is the widget's class command, such as B<canvas>. |
| 309 |
|
| 310 |
=item I<$widget>-E<gt>B<name> |
| 311 |
|
| 312 |
Returns I<$widget>'s name (i.e. its name within its parent, as opposed |
| 313 |
to its full path name). |
| 314 |
The command I<$mainwin>-E<gt>B<name> will return the name of the application. |
| 315 |
|
| 316 |
=item I<$widget>-E<gt>B<OnDestroy>(I<callback>); |
| 317 |
|
| 318 |
OnDestroy accepts a standard perl/Tk I<callback>. |
| 319 |
When the window associated with I<$widget> is destroyed then |
| 320 |
the callback is invoked. Unlike I<$widget->>bind('E<lt>DestroyE<gt>',...) |
| 321 |
the widgets methods are still available when I<callback> is executed, |
| 322 |
so (for example) a B<Text> widget can save its contents to a file. |
| 323 |
|
| 324 |
OnDestroy was required for new B<after> mechanism. |
| 325 |
|
| 326 |
=item I<$widget>-E<gt>B<parent> |
| 327 |
|
| 328 |
Returns I<$widget>'s parent, or an empty string |
| 329 |
if I<$widget> is the main window of the application. |
| 330 |
|
| 331 |
=item I<$widget>-E<gt>B<PathName> |
| 332 |
|
| 333 |
Returns the Tk path name of I<$widget>. This is the inverse of the |
| 334 |
L</Widget> method. (This is an import from the C interface.) |
| 335 |
|
| 336 |
=item I<$widget>-E<gt>B<pathname>(I<id>) |
| 337 |
|
| 338 |
Returns an object whose X identifier is I<id>. |
| 339 |
The identifier is looked up on the display of I<$widget>. |
| 340 |
I<Id> must be a decimal, hexadecimal, or octal integer and must |
| 341 |
correspond to a window in the invoking application, or an error |
| 342 |
occurs which can be trapped with C<eval { }> or C<Tk::catch { }>. |
| 343 |
If the window belongs to the application, but is not an object |
| 344 |
(for example wrapper windows, HList header, etc.) then C<undef> |
| 345 |
is returned. |
| 346 |
|
| 347 |
=item I<$widget>-E<gt>B<pixels>(I<number>) |
| 348 |
|
| 349 |
Returns the number of pixels in I<$widget> corresponding |
| 350 |
to the distance given by I<number>. |
| 351 |
I<Number> may be specified in any of the forms acceptable |
| 352 |
to B<Tk_GetPixels>, such as ``2.0c'' or ``1i''. |
| 353 |
The result is rounded to the nearest integer value; for a |
| 354 |
fractional result, use I<$widget>-E<gt>B<fpixels>. |
| 355 |
|
| 356 |
=item I<$widget>-E<gt>B<pointerx> |
| 357 |
|
| 358 |
If the mouse pointer is on the same screen as I<$widget>, returns the |
| 359 |
pointer's x coordinate, measured in pixels in the screen's root window. |
| 360 |
If a virtual root window is in use on the screen, the position is |
| 361 |
measured in the virtual root. |
| 362 |
If the mouse pointer isn't on the same screen as I<$widget> then |
| 363 |
-1 is returned. |
| 364 |
|
| 365 |
=item I<$widget>-E<gt>B<pointerxy> |
| 366 |
|
| 367 |
If the mouse pointer is on the same screen as I<$widget>, returns a list |
| 368 |
with two elements, which are the pointer's x and y coordinates measured |
| 369 |
in pixels in the screen's root window. |
| 370 |
If a virtual root window is in use on the screen, the position |
| 371 |
is computed in the virtual root. |
| 372 |
If the mouse pointer isn't on the same screen as I<$widget> then |
| 373 |
both of the returned coordinates are -1. |
| 374 |
|
| 375 |
=item I<$widget>-E<gt>B<pointery> |
| 376 |
|
| 377 |
If the mouse pointer is on the same screen as I<$widget>, returns the |
| 378 |
pointer's y coordinate, measured in pixels in the screen's root window. |
| 379 |
If a virtual root window is in use on the screen, the position |
| 380 |
is computed in the virtual root. |
| 381 |
If the mouse pointer isn't on the same screen as I<$widget> then |
| 382 |
-1 is returned. |
| 383 |
|
| 384 |
=item I<$widget>-E<gt>B<raise>(?I<aboveThis>?) |
| 385 |
|
| 386 |
If the I<aboveThis> argument is omitted then the command raises |
| 387 |
$widget so that it is above all of its siblings in the stacking |
| 388 |
order (it will not be obscured by any siblings and will obscure |
| 389 |
any siblings that overlap it). |
| 390 |
If I<aboveThis> is specified then it must be the path name of |
| 391 |
a window that is either a sibling of $widget or the descendant |
| 392 |
of a sibling of $widget. |
| 393 |
In this case the B<raise> command will insert |
| 394 |
$widget into the stacking order just above I<aboveThis> |
| 395 |
(or the ancestor of I<aboveThis> that is a sibling of $widget); |
| 396 |
this could end up either raising or lowering $widget. |
| 397 |
|
| 398 |
=item I<$widget>-E<gt>B<reqheight> |
| 399 |
|
| 400 |
Returns a decimal string giving I<$widget>'s requested height, |
| 401 |
in pixels. This is the value used by I<$widget>'s geometry |
| 402 |
manager to compute its geometry. |
| 403 |
|
| 404 |
=item I<$widget>-E<gt>B<reqwidth> |
| 405 |
|
| 406 |
Returns a decimal string giving I<$widget>'s requested width, |
| 407 |
in pixels. This is the value used by I<$widget>'s geometry |
| 408 |
manager to compute its geometry. |
| 409 |
|
| 410 |
=item I<$widget>-E<gt>B<rgb>(I<color>) |
| 411 |
|
| 412 |
Returns a list containing three decimal values, which are the |
| 413 |
red, green, and blue intensities that correspond to I<color> in |
| 414 |
the window given by I<$widget>. I<Color> |
| 415 |
may be specified in any of the forms acceptable for a color |
| 416 |
option. |
| 417 |
|
| 418 |
=item I<$widget>-E<gt>B<rootx> |
| 419 |
|
| 420 |
Returns a decimal string giving the x-coordinate, in the root |
| 421 |
window of the screen, of the |
| 422 |
upper-left corner of I<$widget>'s border (or I<$widget> if it |
| 423 |
has no border). |
| 424 |
|
| 425 |
=item I<$widget>-E<gt>B<rooty> |
| 426 |
|
| 427 |
Returns a decimal string giving the y-coordinate, in the root |
| 428 |
window of the screen, of the |
| 429 |
upper-left corner of I<$widget>'s border (or I<$widget> if it |
| 430 |
has no border). |
| 431 |
|
| 432 |
=item I<$widget>-E<gt>B<scaling>?(I<number>)? |
| 433 |
|
| 434 |
Sets and queries the current scaling factor used by Tk to convert between |
| 435 |
physical units (for example, points, inches, or millimeters) and pixels. The |
| 436 |
I<number> argument is a floating point number that specifies the number of |
| 437 |
pixels per point on $widget's display. If the I<number> argument is |
| 438 |
omitted, the current value of the scaling factor is returned. |
| 439 |
|
| 440 |
A ``point'' is a unit of measurement equal to 1/72 inch. A scaling factor |
| 441 |
of 1.0 corresponds to 1 pixel per point, which is equivalent to a standard |
| 442 |
72 dpi monitor. A scaling factor of 1.25 would mean 1.25 pixels per point, |
| 443 |
which is the setting for a 90 dpi monitor; setting the scaling factor to |
| 444 |
1.25 on a 72 dpi monitor would cause everything in the application to be |
| 445 |
displayed 1.25 times as large as normal. The initial value for the scaling |
| 446 |
factor is set when the application starts, based on properties of the |
| 447 |
installed monitor (as reported via the window system), |
| 448 |
but it can be changed at any time. Measurements made |
| 449 |
after the scaling factor is changed will use the new scaling factor, but it |
| 450 |
is undefined whether existing widgets will resize themselves dynamically to |
| •451 |
accommodate the new scaling factor. |
| 452 |
|
| 453 |
=item I<$widget>-E<gt>B<screen> |
| 454 |
|
| 455 |
Returns the name of the screen associated with I<$widget>, in |
| 456 |
the form I<displayName>.I<screenIndex>. |
| 457 |
|
| 458 |
=item I<$widget>-E<gt>B<screencells> |
| 459 |
|
| 460 |
Returns a decimal string giving the number of cells in the default |
| 461 |
color map for I<$widget>'s screen. |
| 462 |
|
| 463 |
=item I<$widget>-E<gt>B<screendepth> |
| 464 |
|
| 465 |
Returns a decimal string giving the depth of the root window |
| 466 |
of I<$widget>'s screen (number of bits per pixel). |
| 467 |
|
| 468 |
=item I<$widget>-E<gt>B<screenheight> |
| 469 |
|
| 470 |
Returns a decimal string giving the height of I<$widget>'s screen, |
| 471 |
in pixels. |
| 472 |
|
| 473 |
=item I<$widget>-E<gt>B<screenmmheight> |
| 474 |
|
| 475 |
Returns a decimal string giving the height of I<$widget>'s screen, |
| 476 |
in millimeters. |
| 477 |
|
| 478 |
=item I<$widget>-E<gt>B<screenmmwidth> |
| 479 |
|
| 480 |
Returns a decimal string giving the width of I<$widget>'s screen, |
| 481 |
in millimeters. |
| 482 |
|
| 483 |
=item I<$widget>-E<gt>B<screenvisual> |
| 484 |
|
| 485 |
Returns one of the following strings to indicate the default visual |
| 486 |
class for I<$widget>'s screen: B<directcolor>, B<grayscale>, |
| 487 |
B<pseudocolor>, B<staticcolor>, B<staticgray>, or |
| 488 |
B<truecolor>. |
| 489 |
|
| 490 |
=item I<$widget>-E<gt>B<screenwidth> |
| 491 |
|
| 492 |
Returns a decimal string giving the width of I<$widget>'s screen, |
| 493 |
in pixels. |
| 494 |
|
| 495 |
=item I<$widget>-E<gt>B<server> |
| 496 |
|
| 497 |
Returns a string containing information about the server for |
| 498 |
I<$widget>'s display. The exact format of this string may vary |
| 499 |
from platform to platform. For X servers the string |
| 500 |
has the form ``B<X>I<major>B<R>I<minor vendor vendorVersion>'' |
| 501 |
where I<major> and I<minor> are the version and revision |
| 502 |
numbers provided by the server (e.g., B<X11R5>), I<vendor> |
| 503 |
is the name of the vendor for the server, and I<vendorRelease> |
| 504 |
is an integer release number provided by the server. |
| 505 |
|
| 506 |
=item I<$widget>-E<gt>B<toplevel> |
| 507 |
|
| 508 |
Returns the reference of the top-level window containing I<$widget>. |
| 509 |
|
| 510 |
=item I<$widget>-E<gt>B<Unbusy> |
| 511 |
|
| 512 |
Restores widget state after a call to I<$widget>-E<gt>B<Busy>. |
| 513 |
|
| 514 |
=item I<$widget>-E<gt>B<UnmapWindow> |
| 515 |
|
| 516 |
Cause I<$widget> to be "unmapped" i.e. removed from the display. |
| 517 |
This does for any widget what I<$widget>-E<gt>withdraw does for |
| 518 |
toplevel widgets. May confuse the geometry manager (pack, grid, place, ...) |
| 519 |
that thinks it is managing the widget. |
| 520 |
|
| 521 |
=item I<$widget>-E<gt>B<update> |
| 522 |
|
| 523 |
One of two methods which are used to bring the application ``up to date'' |
| 524 |
by entering the event loop repeated until all pending events |
| 525 |
(including idle callbacks) have been processed. |
| 526 |
|
| 527 |
The B<update> method is useful in scripts where you are performing a |
| 528 |
long-running computation but you still want the application to respond |
| 529 |
to events such as user interactions; if you occasionally call |
| 530 |
B<update> then user input will be processed during the next call to |
| 531 |
B<update>. |
| 532 |
|
| 533 |
=item I<$widget>-E<gt>B<useinputmethods>( ?I<boolean>? ) |
| 534 |
|
| 535 |
Sets and queries the state of whether Tk should use XIM (X Input |
| 536 |
Methods) for filtering events. The resulting state is returned. |
| 537 |
XIM is used in some locales (ie: Japanese, Korean), to handle |
| 538 |
special input devices. This feature is only significant on X. |
| 539 |
If XIM support is not available, this will always return 0. |
| 540 |
If the boolean argument is omitted, the current state is |
| 541 |
returned. This is turned on by default for the main display. |
| 542 |
|
| 543 |
=item I<$widget>-E<gt>B<viewable> |
| 544 |
|
| 545 |
Returns 1 if I<$widget> and all of its ancestors up through the |
| 546 |
nearest toplevel window are mapped. Returns 0 if any of these |
| 547 |
windows are not mapped. |
| 548 |
|
| 549 |
=item I<$widget>-E<gt>B<visual> |
| 550 |
|
| 551 |
Returns one of the following strings to indicate the visual |
| 552 |
class for I<$widget>: B<directcolor>, B<grayscale>, |
| 553 |
B<pseudocolor>, B<staticcolor>, B<staticgray>, or |
| 554 |
B<truecolor>. |
| 555 |
|
| 556 |
=item I<$widget>-E<gt>B<visualid> |
| 557 |
|
| 558 |
Returns the X identifier for the visual for $widget. |
| 559 |
|
| 560 |
=item I<$widget>-E<gt>B<visualsavailable>(?B<includeids>?) |
| 561 |
|
| 562 |
Returns a list whose elements describe the visuals available for |
| 563 |
I<$widget>'s screen. |
| 564 |
Each element consists of a visual class followed by an integer depth. |
| 565 |
The class has the same form as returned by I<$widget>-E<gt>B<visual>. |
| 566 |
The depth gives the number of bits per pixel in the visual. |
| 567 |
In addition, if the B<includeids> argument is provided, then the |
| 568 |
depth is followed by the X identifier for the visual. |
| 569 |
|
| 570 |
=item I<$widget>-E<gt>B<vrootheight> |
| 571 |
|
| 572 |
Returns the height of the virtual root window associated with I<$widget> |
| 573 |
if there is one; otherwise returns the height of I<$widget>'s screen. |
| 574 |
|
| 575 |
=item I<$widget>-E<gt>B<vrootwidth> |
| 576 |
|
| 577 |
Returns the width of the virtual root window associated with I<$widget> |
| 578 |
if there is one; otherwise returns the width of I<$widget>'s screen. |
| 579 |
|
| 580 |
=item I<$widget>-E<gt>B<vrootx> |
| 581 |
|
| 582 |
Returns the x-offset of the virtual root window associated with I<$widget>, |
| 583 |
relative to the root window of its screen. |
| 584 |
This is normally either zero or negative. |
| 585 |
Returns 0 if there is no virtual root window for I<$widget>. |
| 586 |
|
| 587 |
=item I<$widget>-E<gt>B<vrooty> |
| 588 |
|
| 589 |
Returns the y-offset of the virtual root window associated with I<$widget>, |
| 590 |
relative to the root window of its screen. |
| 591 |
This is normally either zero or negative. |
| 592 |
Returns 0 if there is no virtual root window for I<$widget>. |
| 593 |
|
| 594 |
=item I<$widget->>B<waitVariable>(\$I<name>) |
| 595 |
|
| 596 |
=item I<$widget->>B<waitVisibility> |
| 597 |
|
| 598 |
=item I<$widget->>B<waitWindow> |
| 599 |
|
| 600 |
The B<tk wait> methods wait for one of several things to happen, |
| 601 |
then it returns without taking any other actions. |
| 602 |
The return value is always an empty string. |
| 603 |
B<waitVariable> expects a reference to a perl |
| 604 |
variable and the command waits for that variable to be modified. |
| 605 |
This form is typically used to wait for a user to finish interacting |
| 606 |
with a dialog which sets the variable as part (possibly final) |
| 607 |
part of the interaction. |
| 608 |
B<waitVisibility> waits for a change in I<$widget>'s |
| 609 |
visibility state (as indicated by the arrival of a VisibilityNotify |
| 610 |
event). This form is typically used to wait for a newly-created |
| 611 |
window to appear on the screen before taking some action. |
| 612 |
B<waitWindow> waits for I<$widget> to be destroyed. |
| 613 |
This form is typically used to wait for a user to finish interacting |
| 614 |
with a dialog box before using the result of that interaction. |
| 615 |
Note that creating and destroying the window each time a dialog is required |
| 616 |
makes code modular but imposes overhead which can be avoided by B<withdrawing> |
| 617 |
the window instead and using B<waitVisibility>. |
| 618 |
|
| 619 |
While the B<tk wait> methods are waiting they processes events in |
| 620 |
the normal fashion, so the application will continue to respond |
| 621 |
to user interactions. |
| 622 |
If an event handler invokes B<tkwait> again, the nested call |
| 623 |
to B<tkwait> must complete before the outer call can complete. |
| 624 |
|
| 625 |
=item I<$widget>-E<gt>B<Walk>(I<proc>?, I<arg, ...>?) |
| 626 |
|
| 627 |
Traverse a widget hierarchy starting at I<$widget> while executing the |
| 628 |
subroutine I<proc> to every visited widget. The arguments I<arg, ...> |
| 629 |
are supplied to the subroutine. |
| 630 |
|
| 631 |
=item I<$widget>-E<gt>B<Widget>(I<pathname>) |
| 632 |
|
| 633 |
Returns the widget reference for the given Tk path name, or C<undef> |
| 634 |
if the path name does not match a Tk widget. This is the inverse of |
| 635 |
the L</PathName> method. (This is an import from the C interface.) |
| 636 |
|
| 637 |
=item I<$widget>-E<gt>B<width> |
| 638 |
|
| 639 |
Returns a decimal string giving I<$widget>'s width in pixels. |
| 640 |
When a window is first created its width will be 1 pixel; the |
| 641 |
width will eventually be changed by a geometry manager to fulfill |
| 642 |
the window's needs. |
| 643 |
If you need the true width immediately after creating a widget, |
| 644 |
invoke B<update> to force the geometry manager to arrange it, |
| 645 |
or use I<$widget>-E<gt>B<reqwidth> to get the window's requested width |
| 646 |
instead of its actual width. |
| 647 |
|
| 648 |
=item I<$widget>-E<gt>B<windowingsystem> |
| 649 |
|
| 650 |
Returns the current Tk windowing system, one of B<x11> (X11-based), |
| 651 |
B<win32> (MS Windows), B<classic> (Mac OS Classic), or B<aqua> (Mac OS X Aqua). |
| 652 |
|
| 653 |
=item I<$widget>-E<gt>B<x> |
| 654 |
|
| 655 |
Returns a decimal string giving the x-coordinate, in I<$widget>'s |
| 656 |
parent, of the upper-left corner of I<$widget>'s border (or I<$widget> |
| 657 |
if it has no border). |
| 658 |
|
| 659 |
=item I<$widget>-E<gt>B<y> |
| 660 |
|
| 661 |
Returns a decimal string giving the y-coordinate, in I<$widget>'s |
| 662 |
parent, of the |
| 663 |
upper-left corner of I<$widget>'s border (or I<$widget> if it |
| 664 |
has no border). |
| 665 |
|
| 666 |
=back |
| 667 |
|
| 668 |
=head1 CAVEATS |
| 669 |
|
| •670 |
The above documentation on generic methods is incomplete. |
| 671 |
|
| 672 |
=head1 KEYWORDS |
| 673 |
|
| 674 |
atom, children, class, geometry, height, identifier, information, interpreters, |
| 675 |
mapped, parent, path name, screen, virtual root, width, window |
| 676 |
|
| 677 |
=cut |
| 678 |
|