The MsgBox class implements the pre-defined message-box dialog. This is a top-level object (i.e. it should not be opened as the child of a window).
To use the dialog, you must first create it as a top-level object using the New method; it will remain hidden at this stage. You can then set up the dialog using the following properties:
caption: The dialog title as a character vector.
text: The text to appear in the message-box, as a character vector.
style: The buttons to appear in the message-box, as an integer scalar. Valid values are:
0 = OK only 1 = OK and Cancel 2 = Retry and Cancel 3 = Yes and No 4 = Yes, No and Cancel 5 = Abort, Retry and Ignore
icon: Icon as an integer scalar (default 0):
0 = Stop 1 = Alert 2 = Note 3 = Question -1 = None
default: The button to use as the default (1 to 4 - see button numbers below)
Displaying the dialog
When you are ready to show the dialog, call the Show method. This displays the modal dialog, and waits for the user to press one of the buttons. The Show method returns the button which the user pressed to end the dialog:
1 = OK 2 = Cancel 3 = Abort 4 = Retry 5 = Ignore 6 = Yes. 7 = No ¯1 = The dialog ended without a button being clicked
Finally, you will normally call the Delete method to dispose of the dialog. Alternatively, you can keep it for re-use later in your application.
∇DEMO_MsgBox;DLG  ⍝ Sample function demonstrating use of the MsgBox object  DLG←'⎕' ⎕NEW 'MsgBox' ⋄ DLG.icon←2 ⋄ DLG.style←1  DLG.caption←'Sample Message'  DLG.text←'Sounds fun. Shall we do it?'  ⍝ Show the dialog. If user presses Cancel, quit  →(2=DLG.Show)/0  ⍝ He pressed OK.  'OK, let''s do it!' ∇
Copyright © 1996-2010 MicroAPL Ltd