[Gnocl -the Tcl/Gtk Bindings] Reworked the gnocl::dialog soucecode

1 view
Skip to first unread message

William J Giddings

unread,
Jul 25, 2015, 6:28:56 PM7/25/15
to gn...@googlegroups.com
With a few notable changes, the dialog.c module was legacy code which tried to do too much. In attempting to add stock icons and embedded buttons so many irreversible bugs had crept into the code which made it almost impossible to prevent an application crashing. A quick glance at the gtk style guide makes no mention to of the use of Stock icons in dialog buttons so,  the best way forward was to retire the inclusion of icons and predefined buttons in favour of something much simpler and far less prone to crashing. The following extract from the development documentation highlights the changes made.

-buttons
type: list (default: Ok)
List of buttons to be displayed consisting of a list of display strings with optional values.
Method 1) Simple Strings.

In this case the text string will be used as the basis of the returned value stripped of any percent string underscore markup.
-buttons "%__Yes %__No"
Clicking the "Yes" button will return "Yes" from the [gnocl::dialog] command or by substitution of the %v parameter in the -onResponse callback script..
Method 2) String and Value.

For more complex display strings the use of an associate value makes response parsing simpler.

Use underscore ("'_") to indicate accelerators, e.g.

-buttons [list [list  {%_P_ortable Document Format} pdf] [list  {%_O_pen Document Text ODT} odt]
As with method 1), clicking the "Portable Document Format " button will return "pdf" from the [gnocl::dialog] command or by substitution of the %v parameter in the -onResponse callback script..

Method 3) Default.

If the -buttons option is not specified then a single "Ok" button will be added to the dialog. This would be equivalent to using:

-buttons "%__Ok"
Note: The use of the %_ prefix is optional and retained for legacy.


To add previously created button widgets, use the -actionButtons option.






--
Posted By William J Giddings to Gnocl -the Tcl/Gtk Bindings on 7/25/2015 11:28:00 p.m.
Reply all
Reply to author
Forward
0 new messages