Reference Guide > W Routines > WwButtonBox Function
  

WwButtonBox Function
Creates a horizontally or vertically oriented box containing push buttons.
Usage
bbox = WwButtonBox(parent, [labels,] callback)
Input Parameters
parent — The parent widget’s ID.
labels — (optional) A string or an array of strings containing the text that is to appear on the buttons. If the labels parameter is defined as a null string or an array of null strings, the function looks for button labels in a resource specification (see Discussion).
callback — A string containing the name of the callback routine.
Returned Value
bbox — The ID of the button box widget.
Input Keywords
Border — Specifies width in pixels of the button box and button borders.
Center — An array specifying the position of the left and right edge of buttons as a percentage of button box width. By default, buttons are spaced evenly in the box.
Form — When present and nonzero, buttons are placed in a form layout and all specified attachment keywords are honored (i.e., /Left, /Right, /Top, /Bottom). By default, buttons are placed in a row/column layout.
Horizontal — If present and nonzero, creates a horizontally aligned row of buttons.
Layout_name — Specifies the name of the container widget used to organize the buttons. The Layout_name specified is the compound widget layout name used in the resource specification. (Default: buttons.)
Measure — Specifies the number of columns of buttons (for a vertical box) or rows (for a horizontal box).
Name — Specifies an array of strings containing the names of the button widgets in a resource specification. The Name keyword can be used in place of the labels parameter, although labels (if other than an array of null strings) will take precedence if both are given. (Default: button_0, button_1, ..., button_n.)
Position — If the button box widget is to be placed in a bulletin board layout, use this keyword to specify the x, y coordinates of the button box widget within the bulletin board.
Tab_WinOff — (Windows only) If this keyword is present and nonzero, the tab navigation feature is turned off for this widget. For button box widgets, use the left, right, down, and up arrow keys to move the focus to the left, right, down, or up within the group.
Vertical — When present and nonzero, creates a vertically aligned column of buttons.
Spacing — Specifies the space in pixels between buttons.
Output Keywords
Buttons — Returns an array of push button widget IDs.
Color/Font Keywords
Background — Specifies the background color name. Background color is the color of the button.
Basecolor — Specifies the base color of the container widget.
Font — Specifies the name of the font used for button text.
MSFont — Adds support for Windows fonts.
Foreground — Specifies the foreground color name. Foreground color is the color of the button text.
Attachment Keywords
Bottom — If a widget ID is specified (for example, Bottom=wid), then the bottom of the button box widget is attached to the top of the specified widget. If no widget ID is specified (for example, /Bottom), then the bottom of the button box widget is attached to the bottom of the parent widget.
Left — If a widget ID is specified (for example, Left=wid), then the left side of the button box widget is attached to the right side of the specified widget. If no widget ID is specified (for example, /Left), then the left side of the button box widget is attached to the left side of the parent widget.
Right — If a widget ID is specified (for example, Right=wid), then the right side of the button box widget is attached to the left side of the specified widget. If no widget ID is specified (for example, /Right), then the button box widget’s right side is attached to the right side of the parent widget.
Top — If a widget ID is specified (for example, Top=wid), then the top of the button box widget is attached to the bottom of the specified widget. If no widget ID is specified (for example, /Top), then the top of the button box widget is attached to the top of the parent widget.
Get/Set Value
getvalue — Gets the label of the selected button.
setvalue — Sets the label of the selected button.
Callback Parameters
Any button box callback procedure must have the following parameters:
wid — The button widget ID.
index — Index of the button pushed (1 – n).
Discussion
The “button box” is a special widget in which individual buttons are arranged. If only one button is requested, that button’s widget ID is returned. By default, the buttons are arranged in a row/column format. See the WwLayout function for information on row/column format.
Part of the button box widget resource names can be specified using the Name keyword, otherwise the defaults are the *.button_#.labelString resources.
 
note
The labels parameter provides a method for “hard-coding” the button names in the application. For greater flexibility, create your resource files using a text editor, and load the resources containing the button names using WtResource. The Name keyword can then be used in the WwButtonBox calling sequence to specify the names for the button widgets.
Example 1
This example creates a button box containing three buttons, Quit, Dialog, and Message. The callback ButtonCB is executed when one of the buttons in the button box is selected.
Enter the callback procedure into a file, and compile the procedure with the .RUN command. Then, enter the widget commands at the WAVE> prompt. To dismiss the button box, select the appropriate function (such as Close) from the window manager menu.
PRO ButtonCB, wid, data
   CASE data OF
      1: PRINT,'Quit Selected'
      2: PRINT,'Dialog Selected'
      3: PRINT,'Message Selected'
   ENDCASE
END
 
PRO ww_ex20
   labels = ['Quit','Dialog','Message']
   top=WwInit('ww_ex20', 'Examples', layout)
   bbox=WwButtonBox(layout, labels,'ButtonCB', /Horizontal, $
      Center=[10,30,40,60,70,100])
   status=WwSetValue(top, /Display)
   WwLoop
END
Example 2
A typical resource specification for the button names used in WwButtonBox is:
myapp.layout.buttonform.quit_button.labelString: Quit 
See Also
For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.
For more information about how to write an application program based on PV‑WAVE Widgets, refer to Using Wave Widgets in the PV‑WAVE Application Developer’s Guide.
For additional information on the color and font keywords, see "Setting Colors and Fonts" in the PV‑WAVE Application Developer’s Guide.
For additional information on attachment keywords, see "Form Layout: Attachments" in the PV‑WAVE Application Developer’s Guide.
For information on Get and Set values, see "Setting and Getting Widget Values" in the PV‑WAVE Application Developer’s Guide.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.