Example: Add a message box
Suppose you want to add a message box to
AlarmClockView. To do so, you open a Composition Editor on
AlarmClockView, add a Message Prompter part, and connect it to other parts in
AlarmClockView.
Adding the part
To add a Message Prompter part:
1. Select
(Prompters category) and
(Message Prompter part).
2. Click on the free-form surface.
The Composition Editor now displays:
Changing the settings
Now, customize the part by changing its settings:
1. Open the Message Prompter part's Properties window.
2. For iconType, select a type that beeps when the message box is displayed, such as XmICONWARNING.
3. In the title field, type a title such as:
4. Get Moving!
5. Don't add a messageString, because the user will specify the message in the Alarm Clock application.
6. For buttonType select XmOK, because the message box only needs one button on it.
Connecting the message box to a push button
Finally, connect an event in the main window for AlarmClockView to the prompt action of the Message Box part. For example, connect the clicked event for the Set Alarm push button, to the prompt action of the Message Box part.
Testing the connection
To display the message box from the Alarm Clock window:
1. Click on
2. In the displayed Alarm Clock window, click on the Set Alarm push button.
Last modified date: 08/14/2019