Skip to content

MessageBox

Anthony Headley edited this page Jul 8, 2020 · 6 revisions

MessageBox(table:options) : table

Brief:

Displays a Message box with many options, a number of features are still to be determined.

Paramiters:

Name Description Optional
table:options table of options detailed below

Options

Name Description Optional
title : string The title for the dialog.
backColor : int|string The dialog chrome color. This color can be a number or string based on the current color theme and can be found at Menu > Desk Lights Color Theme > Edit For example "Global.Selected" or 1.7 is equal to FFD700FF in RGBA
timeout : number Number of MS the dialog will show for
timeoutResultCancel : bool TBD
timeoutResultID : int The result value is the dialog times out
icon : int|string A Texture to display in the top left corner of the dialog. can be a texture name or it's index number. a listing a availible textures and indexes can be found by listing the GraphicsRoot/TextureCollect/Textures path in the console or in onPC by navagating to the C:\ProgramData\MALightingTechnology\gma3_1.1.3\shared\resource\textures folder for a list of names.
titleTextColor : int|string See backColor
messageTextColor : int|string See backColor
message : String multiline dialog message
display : int|handle TBD, set to nil?
commands : table Table of buttons across the bottom of the dialog, detailed in the Command table below
inputs : table Table of Text imputs below the dialog message, detailed in the Inputs table below
states : table Table of check buttons below the inputs, detailed in the States table below

Commands

Name Description Optional
value : int Value of result if command is chosen
name : string Display of the command button

Inputs

Name Description Optional
name : string Name of the Input
value : string Default of the input
blackFilter : string A string that represents characters to block during input e.g. "$()*". ⚠ Seems to only work with TextInput?
whiteFilter : string A string that represents characters to allow during input e.g. "0123456789-". ⚠ Seems to only work with TextInput
vkPlugin : string A named ID reference to special virtual keyboards 'TextInputNumOnly' for a listing see Text Input Plugins
maxTextLength : string The maximum lenth of the entered string, the default value can ignore this number.

States

Name Description Optional
name : string Name of the Checkbox
state : bool Default value of the state?
group : int TBD

Returns:

table: {int:success, int:result, table:inputs, table:states}

Examples:

Example Image

    local options = {
        title="This is a title",                        --string
        backColor="Global.Focus",                       --string: Color based on current theme.
        timeout=10000,                                  --number:in Miliseconds
        timeoutResultCancel=false,                      --bool
        timeoutResultID=-1,                             --number
        icon="time",                                    --int|string
        titleTextColor="Global.AlertText",              --int|string
        messageTextColor=nil,                           --int|string
        message="This is a long\nMultiline\nMessage",   --string
        display= nil,                                   --int? | handle?
        commands={
            {value=0, name="NO"},                       --int, string
            {value=1, name="MAYBE"},
            {value=2, name="YES"}
        },
        inputs={
            {name="INPUT 1", value="123", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 3},
            {name="INPUT 2", value="789ABC", blackFilter="$-=", whiteFilter="", vkPlugin="", maxTextLength = 6},
        },
        states={
            {name="State 1", state = true, group = 1},
            {name="State 2", state = false, group = 1},
            {name="State 3", state = true, group = 2},
            {name="State 4", state = false, group = 2},
            {name="State 5", state = true, group = 3},
            {name="State 6", state = false, group = 3}
        }
    }
    local r = MessageBox(options)

    -- r[success]              -- 
    -- r[result]               -- either the selected Command or timeoutResultID if the timer ran out.
    -- r[<input name>]         -- the value of the input
    -- r[inputs][<input name>] -- same as the above
    -- r[<state name>]         -- the value of the states
    -- r[states][<state name>] -- same as the above
Clone this wiki locally