Application Developer Guide > Using Wave Widgets > Creating Dialog Boxes
  

Creating Dialog Boxes
A dialog box requires user interaction. For instance, the users may enter some text in the dialog box, then “accept” the entry by clicking on a button. If the users do not wish to apply the change to the dialog box, they can click on another button to dismiss it.
The WwDialog function creates dialog boxes.
A Dialog is a Popup Widget
Dialog boxes are popup widgets. This means that they must have an intermediate widget, such as a button, as their parent. The popup widget appears after the user selects this intermediate button. See "Dialog Box Example" for more information.
Blocking vs. Nonblocking Windows
A dialog window can be blocking or nonblocking. Blocking means that no other user action can occur until the dialog is confirmed—the user clicks on OK or Confirm—or until the dialog box is dismissed. The blocking window “blocks” the user from performing other actions as long as the window remains on the screen.
A nonblocking dialog can remain on the screen while the user performs other actions. The nonblocking dialog does not “block” the user from performing other actions.
The WwDialog function has a Block and a Nonblock keyword. Use the Block keyword to create a blocking window and the Nonblock keyword to create a nonblocking window.
Default Dialog Box Buttons
By default, the following three buttons appear along the bottom edge of dialog boxes. These buttons are used to confirm or cancel the dialog box.
*OK—Confirms the input in the dialog.
*Cancel—Cancels the dialog.
*Help—Not supported.
Dialog Box Example
This example creates a button you can click to display a dialog box. To run the example, enter the callback procedures in a file and compile them with the .RUN command. Then enter the widget commands at the prompt.
The “Type something” string is a label for the text box. The DialogOK parameter is the name of a callback that is executed when the user clicks on OK. The DialogCancel parameter is the name of a callback that is executed when Cancel clicked. The result is shown in Dialog Box.
 
Figure 5-25: Dialog Box
Callback Procedures
PRO DbuttonCB, wid, data
select=WwDialog(wid,'Type something:',$
'DialogOK', 'DialogCancel', Title='Type')
END
PRO DialogOK, wid, text
PRINT,'Dialog OK'
value = WwGetValue(text)
PRINT, value
END
PRO DialogCancel, wid, data
PRINT,'Dialog Cancel'
END
Widget Commands
top=WwInit('ww_ex15', 'Examples', layout)
button=WwButtonBox(layout, 'Dialog Box', 'DbuttonCB')
status=WwSetValue(top, /Display)
WwLoop

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