Copyright © 2008, 2009 Arndt Roger Schneider
Gstripes can be used for the typical »tk_getOpenFile«, »tk_getSaveFile« and »tk_messageBox« based dialogs.
These dialogs are hijacked by Gstripes through an event handler, which is registered on the basic dialog classes: »TkFDialog« and »Dialog«.
No extra code is required to activate striped varieties for these Tk dialogs. Only the packages, containing the striped implementation, have to be loaded once.
Example 6.31. Package gstripestkfdialog
# Use striped File Open / Close Dialogs under X11. package require gstripestkfdialog ... # File Open / Close Dialog with Gstripes!
Example 6.32. Package gstripesdialog
# Use stripes for tk_messageBox. package require gstripesdialog ... # tk_messageBox will be striped, now!
Gstripes will change the layout of both dialog types. Buttons are arranged on the fallen diagonal, to better accommodate western-language environments.
Example 6.33. A tk_messageBox
tk_messageBox \ -parent . \ -message "Test Message" \ -title "Stripes MessageBox" \ -type yesnocancel \ -default yes \ -icon question
The button layout can be changed for the striped tk_messageBox. There is a new Option Database property »layout« for class »Dialog«. These property contains triple entries for each button stating the »ID« inside the w array, the »column« and the on-default state for the button’s default frame.
Example 6.34. Layout definition for tk_messageBox
# id column state of default frame option add *Dialog.layout { 8 1 disabled 7 1 disabled 5 1 disabled 4 7 disabled 6 9 active 3 9 active } # Button Layout as defined by »layout« # abort/retry ~ x ... cancel ~ no ~ yes/OK # 1 ~ 3 5 ~ 7 ~ 9 # Default frames are enabled for yes and OK.
The columns 0,2,4,6,8,10 feature 6 pixels, to distribute the buttons equidistantly. Column 4 has a additional weight attribute.
There is no custom »layout« for the file dialogs.
The striped dialogs are compatible with Tile.
tk_messageBox should allow to replace the caption for each dialog button. This could be done for the striped variant! But must also happen for AQUA® and Microsoft-Windows®, which are unaffected by Gstripes! That is why I left it as-it-is, sorry.