Application Developer Guide > Using Wave Widgets > Creating a Button Box and a Tool Box
  

Creating a Button Box and a Tool Box
A button box and a tool box serve similar functions—both trigger specific actions when the user clicks on an item. A button box contains an array of labeled buttons, organized in rows or columns. A tool box contains an array of icons (graphical buttons), also arranged in rows or columns.
Buttons and icons are usually used to apply changes, confirm decisions, display new windows, or start new applications. When the user clicks on a button or icon, its three-dimensional appearance inverts, so that it looks like the button has been depressed. When the button or icon is released, it returns to its normal appearance.
Button Box Example
A button box is created with the WwButtonBox function. In the following example layout is the parent widget. ButtonCB is the name of the procedure that is executed when a button is selected. The buttons are arranged horizontally and spaced 20 pixels apart. WwButtonBox is passed two parameters—the button box widget ID and a value that corresponds to the selected button. The result is shown in Button Box.
top=WwInit('ww_ex6', 'Examples', layout)
labels = ['Quit','Dialog','Message', 'FileSelection', 'Command']
bbox=WwButtonBox(layout, labels,'ButtonCB', /Horizontal, $
Spacing=20)
status=WwSetValue(top, /Display)
WwLoop
 
Figure 5-15: Button Box
Tool Box Example
A tool box is created with the WwToolBox function. This example creates a tool box containing four icons, arranged in two columns, which are specified in the string array pixmaps. DrawnCB is the name of the callback routine (not shown) that is executed when a button is selected. The result is shown in Toolbox.
top=WwInit('ww_ex7', 'Examples', layout)
; Create a variable “pixmaps” that contains the paths to the
; graphics files used for the icons.
pixmaps = [getenv('WAVE_DIR')+'/xres/wxbm_btn_help_search',$
getenv('WAVE_DIR')+'/xres/wxbm_btn_help_toc',$
getenv('WAVE_DIR')+'/xres/wxbm_btn_help_topics',$
getenv('WAVE_DIR')+'/xres/wxbm_btn_help_quit']
; The tool box is created with four buttons, spaced 20 pixels 
; apart, and arranged in two columns.
dbox=WwToolBox(layout, pixmaps, 'DrawnCB', /Vertical, $
Spacing=20, Measure=2)
status=WwSetValue(top, /Display)
WwLoop
 
Figure 5-16: Toolbox

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.