Modal dialogs

 
 
 

ELF provides command support for two different pre-packaged modal dialogs. Both dialogs allow user configurability of the message text, number of buttons, and button label text. The enter and escape keys are also supported.

A confirm dialog provides a message and user definable buttons through the “confirmDialog” command. When the dialog is dismissed the command returns which button was selected. For example the following command will produce the dialog shown below.

confirmDialog -message "Are you sure?" -button "Yes" -button "No"
 -defaultButton "Yes" -cancelButton "No" -dismissString "No";

The “-defaultButton” flag indicates which button will be selected if the enter key is pressed, and the “-cancelButton” flag indicates which button will be selected if the escape key is pressed.

A prompt dialog works similarly to a confirm dialog except that it also provides an editable scrolling field through which the end user can reply to the prompted question. For example the following command will produce the dialog shown below.

promptDialog -message "Enter name:" -button "Ok" -button "Cancel"
 -defaultButton "Ok" -cancelButton "Cancel" -dismissString "Cancel";

After the dialog has been dismissed the you can query the “promptDialog” command for the text that the user entered; for example, promptDialog -query; This will return any text typed into the scroll field by the user.