Functional Aspects

Functional aspects refer to the link between the Graphical User Interface and the application logic. It encompasses call back commands and also the display of certain values.

The most prominent functional property is »command«. The command property is featured by menu command, menu checkbutton, menu radiobutton, Goolbar command, Goolbar checkbutton, Goolbar radiobutton, button, checkbutton, radiobutton ...

A Tcl-script is assigned to the command property. The assigned Tcl-script gets evaluated whenever the control or items is invoked. This usually happens in response to a left-mouse-button click. A mouse-click is composed of mouse -press and -release on the same control.

variable, textvariable, listvariable. These properties tell the control from where to collect the data. This data may then being rendered on-screen. value, onvalue and offvalue are associated with variable. These properties are found in checkbutton, radiobutton, menu checkbutton, menu radiobutton, Goolbar checkbutton, Goolbar radiobutton, menubutton, listbox, hugelist, rtl_mlistbox, tablelist and more.

There usually is a »trace« on those variables assigned to a control. The display or state of a control changes, in response to the value of that variable.

The »state« property alters the controls behavior. Major values for state are »normal«, »disabled«, »active«. A control or canvas item in a disabled state refuses any interaction. The control is inert. State is an almost universal property, even canvas and TkZinc 3.3.4 items have state properties. For graphical objects an additional state »hidden« exists. A hidden item isn’t rendered on-screen.

There are many more functional properties, many of them apply to only a single window class.

Some Specific Functional Properties


contextfcn, dragfcn, hasChildrenfcn, openfcn, selectfcn.

Dealing with on-demand data acquisition and notifications.

menu cascade, menubutton, toplevel

Menu: Which menu will be used as a menu bar or sub-menu when the associated cascade entry is activated.


tearoffcommand, postcommand.

Postcommand is an important property. It allows to dynamically recreate or customize a menu immediately before it is displayed. Striped menus rely on »postcommand«, to pospone striping a menu to the last moment.

Using postcommand is very important under AQUA® too. The values inside menu checkbutton and radiobutton are not properly reflected in the visible menu (Tk 8.4). Furthermore the AQUA® HCI Guidelines recommends to abuse the labels inside of checkbutton entries to reflect their current state literally. This can’t be predefined for Tk menu entries.


customzecommand, hidecommand, tearoffcommand.

The customizecommand defines how to customize the Goolbar, by deploying a Gooleditor. A menu entry will appear inside the Goolbar context menu.

scrollbar, rtl_gridwin

xscrollstartcommand, yscrollstartcommand, xscrollstopcommand, yscrollstopcommand.

Binds scrollbars to a sibling window with content. For the rtl_gridwin it is sufficient to assign the scroll able window to the »-window« property, the rest is done by the rtl_gridwin.

Jeszra uses an elaborated scheme to determine how to represent a given command as Tcl-source code. Any property can be represented as an »atom«, a string either encapsulated in curly braces or subst, and as list. List or curly braces are preferred by Jeszra, to ensure that the resulting code is context independent.

Property Encapsulation


An atom is a single non-white space sequence. Colours and dimensions are usually created as atoms.

-background red
-foreground #fff
Curly braces, {}

Curly braces enclose either strings or lists. The contents of such a property is taken as is and does not get evaluated. Curly braces are for Option Database entries and also for Message Catalog data. In case of Message Catalog entries: A call to »mc« is placed before the string.

-text {This is a text string}
-command {
    ThisIsAScript evaluated;
    WheneverTheCommand EventHandler;
    OfTheControlInQuestionIsBeing triggered;

# Option Database with curly braces and »mc«:
option add *MyTemplate.label.text \
   {ODB String value}

# The message catalog is feed into
# the option database.
option add *MyTemplate.label_2.text \
   [mc {ODB String value}]
list, subst

The two remaining forms are related to command scripts. »list« is the preferred form. »list« is context free, whereas »subst« is not.

Jeszra has to resort to subst for consecutive commands. Such as an additional »break« inside an event binding. It is safer to use single commands and thus avoiding »subst«.

-command [list doSomethingWith $base]

# Here subst is unavoidable:
bind $base$w(1) <1> [subst {
     doSomethingWith $base$w(2);

# Better use an event wrapper returning break.
proc eventBreakDoSomethingWith window {
  doSomethingWith $window;
  return -break
bind $base$w(1) <1> \
   [list eventBreakDoSomethingWith $base$w(2)]

Jeszra tries to avoid both forms. »list« and »subst« are usually used for variable substitutions. Typical situations are references to window path names –as seen in the code fragment above– through variables ($base, $base$w(n)).

Variable substitutions are auto-generated by Jeszra. The variable substitution occurs for every window path name used inside of a command property or event handler.

.my.window ➟  $base$w(1)
.my ➟  $base$w(0)
.window := contents of template 
           variable »w« with index 1.