Copyright © 2008, 2009 Arndt Roger Schneider
The typical interactive controls from Tcl/Tk can be hijacked under X Window System when TkPath and CAIRO® are present. Active controls are left alone by Gstripes under AQUA® and Microsoft-Windows®. However Gstripes can be forced to hijack active controls under AQUA® and Microsoft-Windows®.
This section is dedicated to X Window System, with the exception of groups.
Controls are ignored by Gstripes whenever »compound« is defined. Stand alone checkbutton and radiobutton with »indicatorOn« turned off (0) are ignored, too.
A hijacked control does not automatically receive change events for properties. Make sure to inform the Gstripes window after such a change has occurred. This is very important for »state« changes. See also Example 6.26, “Modifying hijacked windows”.
Call »modified« with the window path in question after a property has changed.
The overall Gstripes design follows the Tcl/Tk design from version »8.0«.
The anchor properties is an anachronism; predating the »grid« geometry manager. Make »grid« the default geometry manager. And use »pack« for ragged layouts alone – don’t design exclusively with »pack«!
highlightBackground is required by Tk controls to create white space around the visual border of said control. A hijacked control directly interacts with the white space created through the Gstripes window. The highlight area is simply yielded to the Gstripes window.
Done inside the control through a gradient and a solid border (with »borderColor«).
Please send a use-case to me, if you think there is a need for »relief«.
OverRelief is used to mimic toolbar items with buttons. Use the Goolbar instead.
This feature is whimsical and better avoided at all.
Now, whenever the mouse-pointer enters the control, then »activeBackground« replaces »background« as its colour. The control fades back into white space after the mouse-pointer has left it.
The above substitution requires TkPath 0.2, and can’t be used with a Zoolbar.
Any Tcl/Tk button window can be hijacked by Gstripes.
A button is represented by a rounded shape, 1-third of its height. If there is more than one text character on it.
The button will have a square shape (not rounded), if there is only a single character on it — a glyph— or when an image is used.
The button shape is customizable from within the Option Database; use the »radius« property to do so.
A button must not contain multiple lines (Newline-characters).
Unsupported button properties
Multi line text isn’t supported and consequently neither is »justify« nor »wrapLength« required.
The »text« property is recessive to »image«.
Additional Option Database properties
These properties are used in conjunction with the »image« property. »activeImage« is used whenever the cursor is inside the control. The control is in state active.
»disabledImage« is used instead of »image« when the control is disabled. The control is inert.
The border width is derived from the »borderWidth« property.
Dimension for the highlight frame around a »default« button. The unaltered dimension is 5 pixel.
A default button has the permanent state »active«.
A new Option Database property ».boundariesVector« is introduced in version 1.1. »boundariesVector« allows arbitrary shapes for any menubutton or button. The default rectangular shape is defined in the vector: »gstripesvector::vanilla«.
The Option Database properties »emphasis« and »emphasisVector« can be set and combine multiple vectors for a single control. The »emphasis« property expects a boolean value activating the emphasisVector.
A menubutton is visually similar to a button. It displays a slightly rounded (4 pixel) shape with a sunken menu indicator to the right.
A menubutton has a square shape with only a single character as text.
There is a bug with the hijacked menubutton and menus: a posted menu can’t be closed by clicking outside the menu. Use the escape key instead.
Unsupported Menubutton Properties
Multi line text isn’t supported and consequently neither is »justify« nor »wrapLength« needed.
Images are not supported for menubuttons. Not even inside a group!
The property »indicatorOn« is ignored for menubuttons and »on« is assumed.
The indicator of checkbutton and radiobutton is an icon, representing the normal form of a checkbutton or radiobutton. The normal form of checkbutton and radiobutton is identical to that of a button, except that their state is revealed by a depressed representation and / or a distinct colour change. The normal form, of checkbutton and radiobutton, appears inside of groups . Example for such a radiobutton groups, can be seen under AQUA®, were it’s common for constructing tabsets. Radiobutton and checkbutton groups are nowadays supported by all major windowing system including Microsoft-Windows®.
A radiobutton or checkbutton with an indicator is being used for stand alone controls. The entire body of the control fades into the surrounding white space , except for the indicator.
Indicators are definable for individual checkbuttons, radiobuttons and menus. Use the Option Database property »indicatorVector« to defined an individual indicator.
»indicatorOn« is required! Otherwise the control is ignored.
»compound« must be »none«! Otherwise the control is ignored.
A hijacked checkbutton features an indicator and multi-line text. The indicator position is determined by the »justify« property. That is: the text will be aligned according to »justify« and the indicator placed at the beginning or end of the first line.
The indicator is aligned to the outer border of the control, with a distance of »highlightThickness«.
An right aligned indicator is slightly moved to the left. The adjustment is controlled by »padX«, which is otherwise ignored. This makes it possible to keep the check mark inside the boundaries of the control.
Checkbuttons and radiobuttons fade into white space. Only the indicator remains opaque, featuring the background colour.
Use »modify« after state or property changes.
Example 6.12. Radiobutton State Changed
# Be aware path names are truncated! set myvariable 0 radiobutton .myradio \ -variable ::myvariable \ -value 1 ... set myvariable 1 .mystripes modified .myradio
It was however never combined into a single control. Which is the clear purpose of groups.
A group is defined through the group leader. The group leader is the left-most item inside a group. It doesn’t matter where the group leader appears in the group definition! The group will be sorted left oriented.
Example 6.13. Making of a Radio group
# Be aware window path names are truncated! radiobutton .radioa radiobutton .radiob # On screen grid .radioa -column 0 -row 0 -sticky news grid .radiob -column 1 -row 0 -sticky news # Stripe the parent window of radioa and b. gstripes .stripes ... # Somewhere else in response # to Map and Configure Events: .stripes hijackwindow {.radioa .radiob}
A group may contain buttons, menubuttons, radiobuttons and checkbuttons. It is possible to mix this various controls within a group. Recommendation is not to mix various control types inside a single group.
Any item inside the group will answer to the before mentioned restrictions. That is single line, no compound.
Checkbutton and radiobutton will accept »image« and »selectImage« and through the Option Database also »activeImage« and »disabledImage«.
A group should feature a certain radius to better communicate its function through its shape.
The group members do not longer exist as singular controls and thus have to answer to the group design. Disabled controls will not fade into white space. And the background colour is defined through the group leader and not the individual member!
In Tk, windows can act as managers for their sibling windows.
Whenever the window hierarchy differs from the management hierarchy as is shown in Example 6.14, “Sibling Management”, »update idletask« must be called before the proper coordinates of each group member can be retrieved. This is done by defining the »update« property inside of the Option Database for the first group item.
Also hijack the container of such a sibling managed group!
The AQUA® gradients inside Gstripes are colour independent. That is, each background colour can be used with these gradients. For every target colour a coloured gradient is being created and cached inside a local storage. Previous gradients are being reused whenever possible. For TkPath 0.3 a cache is kept for each canvas window –with 0.2 a global cache structure.
Buttons, radiobuttons, etc. under AQUA® feature a sophisticated multi-colour background. Gstripes is able to work with sophisticated multi-colour gradients. All, that is required, is to replace the cached gradients for a distinct colour through a pre-defined, hand-crafted gradient.
Predefined gradients can be used with TkPath 0.2.4 to 0.2.8, only.
The Figure 6.39, “Hand-crafted Gradients under AQUA®” features hand-crafted gradients, stored inside the Gstripes gradient cache. The exact gradients are presented in Example 6.16, “Manipulating The Gstripes Cache”.
The presented »selectColor« in Example 6.16, “Manipulating The Gstripes Cache” and its newly associated gradient do not match the AQUA® colour exactly. The normal »gray93« background however is very close indeed.
Predefined gradients requires TkPath 0.2.4 to 0.2.8.
Gstripes is used for the Rtl_combobox, Rtl_gridwin focus frames – fading into white space, and groups under AQUA®. Avoid using menu buttons inside of groups, because the displayed indicator won’t match that of AQUA®.
Avoid using images inside of groups under AQUA®. Controls holding images do have unexpected side-effects under Tk-AQUA®. Best Practice: Use font glyphs as icons inside of groups.
The Gstripes features »shadows« under AQUA®. The »shadow« is controlled by »shadowWidth« and »shadowOpacity« for a group leader. The normal shadow is designed to work well under AQUA®. The Gistbox button group does not feature a shadow, though. The shadow is disabled by setting its »shadowWidth« to »0«.