Creating and using prompters
CommonWidgets provides three prompters that can be used to prompt the user for information required by the application. The user must reply to the prompt before the application can continue execution. The following three prompters are provided:
CwMessagePrompter
Displays a message and waits for the user to press a button in response
CwTextPrompter
Displays a message and prompts the user for a single line of text as a reply
CwFileSelectionPrompter
Prompts the user for the path name of a file
Prompters are an extension of the OSF/Motif API implemented using the platform's native prompters, where available. Prompters are not widgets, but provide a convenient, portable mechanism to access platform-specific prompting services.
The CwMessagePrompter provides functionality similar to the CwMessageBox widget described earlier. The difference is that CwMessagePrompter uses the platform's message prompter, whereas CwMessageBox provides the behavior of the Motif message box. On Motif platforms, CwMessagePrompter is implemented using CwMessageBox.
Prompters can be created in two ways:
• With an associated parent widget tree, using an expression such as <prompterClass> for: aCwWidget
• Without an associated parent widget tree, using an expression such as <prompterClass> new
A prompter can be configured with several settings, described below. Default values are provided for all settings of a prompter.
The modality of a prompter can be changed using the prompterStyle: method. Valid prompter styles, in order of restrictiveness, are:
XmPRIMARYAPPLICATIONMODAL
The user must respond to the prompter before being able to resume interaction with the receiver's parent window. Interaction with other windows is still possible.
XmFULLAPPLICATIONMODAL
The user must respond to the prompter before being able to resume interaction with any window belonging to the receiver's application. Interaction with windows from other applications is still possible.
XmSYSTEMMODAL
The user cannot interact with the windows of any application until responding to the prompter.
If a platform does not support the specified prompter style, the style is promoted to the next most restrictive style. If no more restrictive style exists, the style is demoted to the next less restrictive style.
The title of the prompter can be set using the title: method.
A prompter is popped up using the prompt method. Control is not returned to the application until the user responds to the prompter. The value returned by the prompt method is nil if the user cancels the prompter. If the user replies to the prompter without canceling, the value returned depends on the type of prompter.
Last modified date: 01/29/2015