Canvas, Text, Panedwindow

In Graphical User Interface s a window is a region with content, mostly of rectangular shape. Drawing operations outside the defined window region are invisible –clipped .

In Tk a window appears in the window hierarchy and has a unique identifier. This identifier is called the window pathname in Tcl/Tk.

The pathname is a list of window names separated by the dot (.) character. The last term is the name of the window and the terms before its ancestors.

Tk contains a special window without a name: dot (.), the root window. The root window is automatically created by Tk whenever a new window hierarchy is established. In Example 2.1, “Tcl/Tk pathnames” ».b« is a child of the root window.

A Tk window can be implemented in either »C« Jeszra does not yet generate C-source code.

The used programming language is irrelevant for the Graphical User Interface performance. Graphical User Interface performance is defined as how quick an application respond to a request –event–, either initiated by the user or through the application. How fast an application should respond is defined by its user. A human being requires time for seeing, deciding and acting. In detail: a normal human being perceives a succession of pictures as continues when they follow within 70ms –motion pictures have 41ms. Deciding and acting require roughly the same time as seeing. Thus a Graphical User Interface is perceived without interruption, when every user initiated action is completed within 3x70ms = 210ms.

Humans adapt easily to a certain speed, but not to speed changes. The solution for an unresponsive action can be to increase the processing time of all other actions.

Hence the performance of an application shall be independent from its data. The related measurement for responsiveness is called complexity . Complexity defines how much the processing time increases with contents. The desired complexity, for all windows, is constant ; which means that the response is independent from contents.

The responsivness of a software is determined by the author of that software and not by the used programming language. For example: the hugelist window, written in Tcl/Tk, has a constant complexity. The Tk listbox window, written in C, has linear complexity on n–were n is the number of all listbox entries.

7 Rules for a well crafted Window

Figure 2.1. Built-In Managers in Hierarchy View

Each of this classes features a built-in geometry manager. Figure 2.1, “Built-In Managers in Hierarchy View” displays the window hierarchy for all three built-in geometry managers.

General purpose geometry managers (pack, grid, place) are recessive to built-in geometry managers in Jeszra.

The canvas built-in geometry manager is called »canvas« and operates similar to »place«.

Figure 2.2. Window embedded in a Canvas

The text built-in geometry manager is called »text«, its geometry has no similarity to any stand-alone manager. The text geometry manager treats windows like glyphs(tokens). Windows float in paragraphs. The closest resemblance, to the text geometry manager, is a wrapped menu bar.

Figure 2.3. Text Managed Window

Paned windows provide a grid like built-in geometry manager. The internal geometry manager features grips, sash for interactive resize operations.

Figure 2.4. Paned Managed Window

Jeszra keeps built-in geometry management and the window structure synchronized. A window, managed by a built-in manager, must be a child of the managing window.

Scalable Vector Graphics cannot be generated from the paned window. The internal decoration is excluded from Scalable Vector Graphics output. The paned decoration would be located between the red and black frame in Figure 2.5, “The Built-In Layout”.

Figure 2.5. The Built-In Layout

The Canvas Items palette contains graphical objects available in the Tk canvas window.

Figure 2.6. Tk Canvas Palette

Canvas Items are almost identical to windows, they have properties, react to events, feature »states« (may interact in predefined ways). The main difference to a window: Canvas Items can only being created and used inside of a »canvas« window.

Jeszra combines vector graphics and application design. The Tk canvas is only a very small part of Jeszra´s abilities. Vector graphics are dealt with in great detail later on in Chapter 6, Vector Graphics.

A text tag is a format description for floating text in a text window.

All text window features are supported by Jeszra, including direct editing and text formatting.

Figure 2.7. Tags, formatted Text

Text formats are organized as »tags«. Tags appear inside the hierarchy view underneath the window node, The hierarchy view resembles Figure 2.7, “Tags, formatted Text” . A tag is selectable and through the Inspector edit able. The Inspector »Geometry« page allows to extend the range of the given tag or to modify existing ranges.

The coordinates from the built-in »sel« tag are re-used, when creating a new tag.

Figure 2.8. Inspector: Tag Ranges