Contents Previous Next Subchapters

Creating A New Dialog Window
Syntax adddialog(captiongeometrycall back)
adddialog(
captiongeometrycall backstyle)
See Also controls , delwin , addeditor , addtable , gaddwin

Description
Creates a dialog window with the specified caption and geometry within the main O-Matrix window. The command specified by call back is executed when the user attempts to close the dialog from the caption bar. O-Matrix does not automatically close the dialog in this case and the call back command should do so if that is appropriate.

The character row vector style must be "normal", "centered", "iconic", "maximized", or "modal". If style is "centered", the dialog is created with the width and height specified by geometry but its position is determined by centering it within the main O-Matrix window. If style is "iconic", the dialog is initially displayed as an icon and it will have the specified geometry when it is normalized. If style is "maximized", the dialog is initially displayed in full-screen mode and it will have the specified geometry when it is normalized. If style is "modal", the dialog is created as a modal window; that is, input is only accepted by this dialog window; the other O-Matrix input window are re-enabled when the modal dialog is deleted. If style is not present, or if it is "normal", the dialog is displayed with the specified geometry and is not modal.

Example
The following program creates a dialog window with a push button labeled "Done". When the user attempts to close the dialog from the caption bar, a beep is sounded. When the button is pressed, the dialog window is deleted.

clear
#
Caption  = "Test Dialog"
geometry = [100, 100, 100, 100]
callback = "beep"
adddialog(Caption, geometry, callback);
#
geometry = [20, 20, 50, 20]
name     = "Done"
callback = "delwin(Caption);"
addcontrol(Caption, geometry, "pushbutton", name, callback);