PackageTop Level
Classpublic class Dialogs

This class contains a number of utility functions to display various dialog boxes. You do not need to construct an instance of this class - instead use the global dialogs object.

See also

Global.dialogs


Public Methods
 MethodDefined by
  
closeSplashForm(formId:Number):void
Closes a splash form opened with showSplashForm.
Dialogs
  
Shows the application configuration dialog.
Dialogs
  
Shows the system "Eject drive" dialog.
Dialogs
  
showForm(controls:Array, title:String = "Appetizer", buttonLabel:String = "OK"):void
Builds and displays a form dialog, which can be used to get user's input.
Dialogs
  
Shows the application "Import" dialog, which allows importing shortcuts.
Dialogs
  
showMessage(message:String, buttons:String = "ok", type:String = "information"):String
Shows a message box to the user.
Dialogs
  
Shows the application "New shortcut" dialog.
Dialogs
  
Shows the Preferences dialog box of the plugin.
Dialogs
  
showSplashForm(message:String, title:String = ""):Number
Displays some text on a modal splash screen.
Dialogs
Method detail
closeSplashForm()method
public function closeSplashForm(formId:Number):void

Closes a splash form opened with showSplashForm.

Parameters
formId:Number — The form identifier

See also

showConfigDialog()method 
public function showConfigDialog():void

Shows the application configuration dialog.

showEjectDriveDialog()method 
public function showEjectDriveDialog():void

Shows the system "Eject drive" dialog.

showForm()method 
public function showForm(controls:Array, title:String = "Appetizer", buttonLabel:String = "OK"):void

Builds and displays a form dialog, which can be used to get user's input. The function takes, as a first parameter, a table of objects, each representing a control (such as a check box or text field). The properties of these controls are the same as the properties of a preference.

Parameters
controls:Array — The table of controls
 
title:String (default = "Appetizer") — The form title
 
buttonLabel:String (default = "OK") — The form button label

See also


Example
This script creates three controls and displays them.
  
 -- Build the table of controls  
 controls = {}  
  
 -- Add a text field  
 table.insert(controls, {  
   type = "Text",  
   name = "textExample",  
   title = "Type some text:",  
   description = "This is a text field"  
 })  
  
 -- Add a check box  
 table.insert(controls, {  
   type = "CheckBox",  
   name = "checkboxExample",  
   defaultValue = "true",  
   title = "Are you sure?"  
 })  
  
 -- Add a popup  
 table.insert(controls, {  
   type = "Popup",  
   name = "popupExample",  
   defaultValue = "two",  
   title = "Popup",  
   options = {  
     one = "First option",  
     two = "Second option",  
     three = "Third option"  
   }  
 })  
  
 -- Display the form  
 result = dialogs:showForm(controls, "Please select some values", "Save")  
  
 if result == null then  
   trace("User cancelled")  
 else  
   for key, value in pairs(result) do  
     trace(key, " = ", value)  
   end  
 end  
  
 appetizer:addEventListener("trayIconMenuOpening", "appetizer_trayIconMenuOpening")  
  
 trace("Listening to the "trayIconMenuOpening" event...")  
 

showImportDialog()method 
public function showImportDialog():void

Shows the application "Import" dialog, which allows importing shortcuts.

showMessage()method 
public function showMessage(message:String, buttons:String = "ok", type:String = "information"):String

Shows a message box to the user. There are four kinds of message boxes: information, warning, error and confirmation. Currently, the only difference between them is that they display a different icon. Additionally, each message box can have different combinations of buttons among yes, no, ok and cancel. When you call this function the script is stopped until the user clicks on a button. You can then check the return value of the function to know which button has been clicked. To display a simple alert box with just an "OK" button, simply use dialogs.showMessage("my message").

Parameters
message:String — The message to display.
 
buttons:String (default = "ok") — The buttons to display. Possible values are "ok", "yesNo" and "yesNoCancel".
 
type:String (default = "information") — The type of message box. Possible values are "information", "warning", "error" and "confirmation".

Returns
String — The button that was clicked. Possible values are "ok", "yes", "no" or "cancel".

Example
This script shows different kinds of message boxes and their results:
  
 result = dialogs:showMessage("This is an error message with an 'ok' button", "ok", "error")  
 dialogs:showMessage("'"..result.."' was clicked")  
  
 result = dialogs:showMessage("This is a warning message with yes / no buttons", "yesNo", "warning")  
 dialogs:showMessage("'"..result.."' was clicked")  
  
 result = dialogs:showMessage("This is a confirmation message with yes / no / cancel buttons", "yesNoCancel", "confirmation")  
 dialogs:showMessage("'"..result.."' was clicked")  
 

showNewShortcutDialog()method 
public function showNewShortcutDialog():void

Shows the application "New shortcut" dialog. If the user clicks "Save" on it, a new shortcut will be created.

showPreferences()method 
public function showPreferences():void

Shows the Preferences dialog box of the plugin.

See also

showSplashForm()method 
public function showSplashForm(message:String, title:String = ""):Number

Displays some text on a modal splash screen. It can be used for example as a "waiting" screen during a time consuming operation. The function returns an ID that you will need to close the form using closeSplashScreen.

Parameters
message:String — The message to display
 
title:String (default = "") — The form title

Returns
Number — The form identifier

See also


Example
This script opens a splash form, does some processing and close the form.
  
 local formId = dialogs:showSplashForm("Operation in progress...", "Please wait...")  
 doSomeTimeConsumingOperationHere()  
 dialogs:closeSplashForm(formId)