GRIDPLUS2 - Menubutton Grid | ![]() |
||||||
|
GRIDPLUS Checkbutton Grid |
In order to simplify creation of screen layouts, GRIDPLUS provides a GRIDPLUS menubutton command mode. This command mode is a "short cut" method to invoke the GRIDPLUS widget command mode with the default widget set create menubuttons. All of the normal widget command mode functionality can be used. For example creating other widget types.
The menus invoked by menu buttons are created using the menu command mode.
This uses a simple syntax to create a grid of menubuttons. The syntax is closely based on the GRIDPLUS Grid and Widget.
GRIDPLUS Menubutton Specific Item Options/Functionality |
See GRIDPLUS Widget Grid for a full list of item options/functionality.
Example |
This section contains an example which illustrates the main GRIDPLUS menubutton 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 menubutton command mode
the "label" defines the text that will appear on the button. Separate labels are not
created for this command. The cell item begining with a dot is the widget (button) ID. The
buttons are created with names based on the name of the containing Grid and the widget ID.
For example: The for the ".mygrid" cell defined by "{"Button 2" .button2}"
a button widget is created with the name ".mygrid,button2". Please note that the
widget name does contain a comma - this is not a misprint!!
When the button is "pressed" (By default) a menu with a name based on that of the widget is invoked.
In the case of the "{"Button 1" .button1}" example the command is called "mygrid,button1:menu".
Note: For the purposes of this example only one menu (".mygrid,button1:menu") is created.
Menubutton Example
gridplus menu .mygrid,button1:menu {
~ {"Option 1" .menu_option1}
~ {"Option 2" .menu_option2}
}
gridplus menubutton .mygrid -title "My Grid" -width 6 -wtitle "Menubutton Example" {
{"Button 1" .button1} {"Button 3" .button3} {"Button 5" .button5}
{"Button 2" .button2} {"Button 4" .button4} {"Button 6" .button6}
}
pack .mygrid
Copyright © 2006 Adrian Davis.