GRIDPLUS2 - Widget Grid | ![]() |
||||||
|
GRIDPLUS Widget Grid |
In order to simplify creation of screen layouts, GRIDPLUS provides a GRIDPLUS widget command mode.
This uses a simple syntax to create a grid of widgets. The syntax is closely based on the GRIDPLUS Grid.
Note: Each item in a GRIDPLUS Widget Grid can contain an Embedded Widget Grid.
GRIDPLUS Widget Specific Item Options/Functionality |
See GRIDPLUS Widget Grid for a full list of item options/functionality.
Notes:
Example |
This section contains an example which illustrates the main GRIDPLUS widget command mode features.
The following example assumes that the reader is familiar with the contents of the Grid/Layout page. Information given on that page will not be duplicated here.
Note: The example assumes that the GRIDPLUS package has already been "required" and the commands imported.
Window:
Source Code:
Comments:
When using the GRIDPLUS widget command mode the
"label" defines the text that will appear as a label to the associated widget. The cell
item begining with a dot is the widget ID. The widgets are created with names based on the name
of the containing Grid and the widget ID. By default label widgets will be created.
For example: The for the ".mygrid1" cell defined by "{&e "Label2" .2}"
an entry widget is created with the name ".mygrid1,2". Please note that the
widget name does contain a comma - this is not a misprint!!
In ".mygrid2" the widget IDs are to the left of the label text. Where appropriate
(checkbutton, entry, radiobutton) - This will create widgets which are to the left of the label text.
In ".mygrid3" the -widget option is used
to set the default widget type to "radiobutton". This has exactly the same effect as creating
a radiobutton grid. Some of the cells simply contain labels.
The widgets under "Label A", as no widget type is specified, will be created as
radiobuttons. The widgets under "Label B" will be created
as checkbuttons as the widget type "&c" is specified.
The column labels ("Label A" and "Label B"), and the widgets in those
columns, have a :c suffix - This causes the
labels/widgets to be centred in the containing cell.
Widget Example 1
gridplus widget .mygrid1 -title "My Grid 1" {
{&b "Label1" .1} {&e "Label2" .2}
{&e "Label3" .3} {&d "Label4" .4}
{&d "Label5" .5} {&b "Label6" .6}
}
gridplus widget .mygrid2 -title "My Grid 2" {
{&b .1 "Label1"}
{&c .2 "Label2"}
{&l .3 "Label3"}
{&m .4 "Label4"}
}
gridplus widget .mygrid3 -widget radiobutton -title "My Grid 3" {
{} {"Label A:c"} {"Label B:c"}
{"Label1"} {.:c +myval1} {&c .1:c}
{"Label2"} {.:c -myval2} {&c .2:c}
{"Label3"} {.:c -myval3} {&c .3:c}
{"Label4"} {.:c -myval4} {&c .4:c}
}
gridplus layout .main -wtitle "Widget Example" {
.mygrid1:ew -
.mygrid2:ns .mygrid3:ew
}
pack .main
Copyright © 2013 Adrian Davis.