UI
The UI
scripting namespace contains functions for interacting with and displaying anything UI related.
Constants
Name | Value |
---|---|
MB_ICON_INFO |
0 |
MB_ICON_QUESTION |
1 |
MB_ICON_WARNING |
2 |
MB_ICON_ERROR |
3 |
Functions
Overview
Message Boxes
File Dialogs
Splash Window
MessageBox
Shows a simple message dialog.
Parameters
title (string ): The dialog captionmessage (string ): The message to display[icon] (integer ): The icon to display on the message box, see theMB_ICON_
constants above. Default isMB_ICON_INFO
MessageBoxExt
Shows an extended message box with an extra scrollable text box displaying
Parameters
title (string ): The dialog captionmessage (string ): The message to displaydetail (string ): The detailed message to display
PromptString
Shows a dialog prompt for the user to enter a string value.
Parameters
title (string ): The dialog captionmessage (string ): The message to displaydefaultValue (string ): The initial default value
Returns
string : The text entered by the user
PromptNumber
Shows a dialog prompt for the user to enter a numeric value.
Parameters
title (string ): The dialog captionmessage (string ): The message to displaydefaultValue (integer ): The initial default valuemin (integer ): The minimum value allowedmax (integer ): The maximum value allowed
Returns
integer : The number entered by the user
PromptYesNo
Shows a dialog prompt with 'Yes' and 'No' buttons.
Parameters
title (string ): The dialog captionmessage (string ): The message to display
Returns
boolean :true
if the user clicked 'Yes'
PromptOpenFile
Shows a file browser dialog allowing the user to select a file to open.
Parameters
title (string ): The dialog captionextensions (string ): A formatted list of selectable file extensions (see description for format)filename (string ): The name of the file to browse for
Returns
string : The full path to the selected file, or an empty string if none selected
Notes
The
[Type Name 1]|[Extension 1]|[Type Name 2]|[Extension 2]|...
Where Type Name X
is the name to display in the type selection dropdown, and Extension
is the wildcard file extension for that type. For an example see below.
Example
local path = UI.PromptOpenFile('Select a File', 'Wad Files (*.wad)|*.wad|All Files|*.*', '')
App.LogMessage('Selected file ' .. path)
PromptOpenFiles
Shows a file browser dialog allowing the user to select multiple files to open.
Parameters
title (string ): The dialog captionextensions (string ): A formatted list of selectable file extensions
Returns
string[] : An array of full paths to the selected files
Notes
See PromptOpenFile
above for the formatting of the
PromptSaveFile
Shows a file browser dialog allowing the user to select a path+filename to save a single file to.
Parameters
title (string ): The dialog captionextensions (string ): A formatted list of selectable file extensions[defaultFilename] (string ): The default name to put in the browser dialog 'file name' text box. Default is""
Returns
string : The full selected path, or an empty string if the dialog was cancelled
Notes
See PromptOpenFile
above for the formatting of the
PromptSaveFiles
Shows a file browser dialog allowing the user to select a path to save multiple files to.
Parameters
title (string ): The dialog captionextensions (string ): A formatted list of selectable file extensions
Returns
string : The directory path to save the files tostring : The file extension that was selected (not the full wildcard, just the extension - eg.wad
or*
)
Notes
See PromptOpenFile
above for the formatting of the
ShowSplash
Shows the splash window with
Parameters
message (string ): The message to show[showProgress] (boolean ): Iftrue
, a progress bar will be shown on the splash window (seeSplashProgress
,SetSplashProgressMessage
,SetSplashProgress
below). Default isfalse
Example
-- Show with no progress bar
UI.ShowSplash('This is a splash window message')
-- Show with progress bar
UI.ShowSplash('Doing some things...', true)
HideSplash
Hides the splash window if it is currently showing.
UpdateSplash
Updates and redraws the splash window.
SplashProgress
Returns
float : The current progress bar progress. This is a floating point number between0.0
(empty) and1.0
(full)
SetSplashMessage
Sets the splash window message.
Parameters
message (string ): The message to show
SetSplashProgressMessage
Sets the small message within the progress bar.
Parameters
message (string ): The message to show in the progress bar
SetSplashProgress
Sets the progress bar progress amount.
Parameters
progress (float ): The progress amount. This is a floating point number between0.0
(empty) and1.0
(full)