GRIDPLUS2 - Spinbox Grid | ![]() |
||||||
|
GRIDPLUS Spinbox Grid |
In order to simplify creation of screen layouts, GRIDPLUS provides a GRIDPLUS spinbox command mode. This command mode is a "short cut" method to invoke the GRIDPLUS widget command mode with the default widget set create spinboxes. All of the normal widget command mode functionality can be used. For example creating other widget types.
This uses a simple syntax to create a grid of boxes. The syntax is closely based on the GRIDPLUS Grid and Widget.
GRIDPLUS Spinbox Specific Item Options/Functionality |
See GRIDPLUS Widget Grid for a full list of item options/functionality.
Setting Spinbox Value Limits and Options |
The spinbox value limits and options will normally be set using the widget option as shown above.
Default values can be set using either the option database or widget grid options:-
Widget Option | Grid Option | Database Name | Default |
number1 | -from | Gridplus.from | {} |
number2 | -to | Gridplus.to | {} |
number3 | -increment | Gridplus.increment | 1 |
format | -spinformat | Gridplus.spinFormat | {} |
NOTE: The minimum requirement is to specify valid -from and -to values.
Example |
This section contains an example which illustrates the main GRIDPLUS spinbox command mode features.
The following example assumes that the reader is familiar with the contents of the Grid/Layout and Widget pages. Information given on those pages 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 spinbox command mode
the "label" defines the text that will appear as a label to the associated spinbox. The cell
item begining with a dot is the widget (spinbox) ID. The spinboxes are created with names
based on the name of the containing Grid and the widget ID.
The widget option begining with a plus sign (+)
defines the minimum, maximum,increment and format values -or- a list of values for the spinbox. This option
is mandatory, minimum and maximum values -or- a value list must be set. The default inital value for the
spinbox is the minimum value -or- the first list value. A specific initial value can be set using the
= option.
This example creates six spinboxes:-
Spinbox Example
gridplus spinbox .mygrid -wtitle Example {
{"My Spin One" .myspin1 +1/20}
{"My Spin Two" .myspin2 {+one two "and three" four}}
{"My Spin Three" .myspin3 {+one two "and three" four} =two}
{"My Spin Four" .myspin4 +00/59//%02.0f}
{"My Spin Five" .myspin5 +-5/5 =0}
{"My Spin Six" .myspin6 +2/10/2}
}
pack .mygrid
Widget Name | Minimum Value / List | Maximum Value | Increment | Format | Initial Value |
.mygrid,myspin1 | 1 | 20 | 1 | {} | 1 |
.mygrid,myspin2 | one two "and three" four | N/A | N/A | N/A | one |
.mygrid,myspin3 | one two "and three" four | N/A | N/A | N/A | two |
.mygrid,myspin4 | 00 | 59 | 1 | %02.0f | 00 |
.mygrid,myspin5 | -5 | 5 | 1 | {} | 0 |
.mygrid,myspin6 | 2 | 10 | 2 | {} | 2 |
Reading and Setting GRIDPLUS Spinbox Values |
The values of the GRIDPLUS widgets are stored in a global array with a null name.
For Example:
global {}
For GRIDPLUS spinbox widgets the array element has the same name as the widget: Thus the value of ".myspin1" in ".mygrid" is referenced as "$(.mygrid,myspin1)".
The recommended method to set GRIDPLUS spinbox values is to use the gpset command.
For Example:
gpset .mygrid,myspin1 5