<< Prev | - Up - | Next >> |
Widget objects as well as instances of other classes defined in the Tk
module are built as object oriented frontends to a single graphical agent, the graphics engine.
The graphics engine receives messages and executes them. By executing a message the engine creates widgets, configures the appearance and behavior of widgets, or computes a geometry for the layout of a widget on the screen.
tickles
The messages the engine understands are tickles. The procedures Tk.send
and Tk.batch
take a tickle or a list of tickles and send it to the graphics engine. We use these two procedures especially to send tickles for geometry management, as is discussed in Chapter 4.
translating object messages to tickles
Messages sent to widgets and other objects of the Tk interface are translated in a straightforward fashion to tickles. These tickles are then forwarded to the graphics engine.
Tickles are used to describe messages for the graphics engine. A tickle is either a boolean value, the name unit
, a virtual string, a record that has neither a name as label nor as feature, or a tickle object. A tickle object is any instance of a class that the Tk module provides, unless otherwise mentioned (the only exception is the class Tk.listener
, see Section 5.6).
An initialization message with label tkInit
must be a record without integer features. The field of a feature must be a tickle. Only the special features parent
, action
, url
, and args
may take different values. These features we will discuss later.
options
To the features we refer to as configuration options, or for short as options. Their values we refer to as option values.
commands and arguments
A message with label tk
must be a record with at least a single integer feature and maybe some other integer features and some options. The value of the first integer feature we call the command, whereas we refer to the remaining values for the integer features as arguments. For example, in the message
tk(set active background:purple)
set
is the command, active
is the single argument, and background
is an option with value purple
.
The graphics engine does not understand tickles but strings that follow a particular structure. This means that each tickle sent to the graphics engine is first translated to a string. The translation is generic, for our purposes here it suffices to give a short example. The full translation details can be found in Chapter 28 of ``System Modules''.
For example,
example("test" 1 2.0 side:left(right:true) fill:x)
is translated to
"example test 1 2.0 -side left -right 1 -fill x"
That is, a record is translated to a string consisting of the label and the features and the translation of the fields. Atomic features are prepended by a "-"
and integer features are ignored.
Additionally, special tickles are supported (see Table 3.1). Their usage becomes clear in the examples that are presented in this document.
Example | Translation | Mnemonic | Used |
---|---|---|---|
|
| option | see Figure 6.1 |
|
| list | list of tickles |
|
| quote | see Figure 6.1 |
|
| string | string of tickles |
|
| position | see * |
|
| batch | see * |
|
| virtual string | verbatim virtual strings |
|
| color | see Figure 5.9 |
|
| delete | skip record label |
<< Prev | - Up - | Next >> |