diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-01-16 20:47:43 -0500 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-01-16 20:47:43 -0500 |
commit | dfd67d28030009d69c2f92938fdaabf64054b346 (patch) | |
tree | 6ee157422946cebca078945b377fbec0c840e50d | |
parent | cb0a8dbdfef18f11837ada591af7e99b793b95a6 (diff) |
Added support for multiple entry boxes in inputdialogs.
Requires latest gtdialog hg (r67).
-rw-r--r-- | core/.ui.dialogs.luadoc | 36 | ||||
-rw-r--r-- | core/ui.lua | 6 |
2 files changed, 33 insertions, 9 deletions
diff --git a/core/.ui.dialogs.luadoc b/core/.ui.dialogs.luadoc index 002fac47..fc943eaa 100644 --- a/core/.ui.dialogs.luadoc +++ b/core/.ui.dialogs.luadoc @@ -113,8 +113,13 @@ function yesno_msgbox(options) end -- @param options Table of key-value option pairs for the input box. -- -- * `title`: The dialog's title text. --- * `informative_text`: The dialog's main message text. --- * `text`: The dialog's initial input text. +-- * `informative_text`: The dialog's main message text. If the value is a +-- table, the first table value is the main message text and any subsequent +-- values are used as the labels for multiple entry boxes. Providing a +-- single label has no effect. +-- * `text`: The dialog's initial input text. If the value is a table, the +-- table values are used to populate the multiple entry boxes defined by +-- `informative_text`. -- * `button1`: The right-most button's label. The default value is -- `_L['_OK']`. -- * `button2`: The middle button's label. @@ -145,8 +150,13 @@ function inputbox(options) end -- @param options Table of key-value option pairs for the input box. -- -- * `title`: The dialog's title text. --- * `informative_text`: The dialog's main message text. --- * `text`: The dialog's initial input text. +-- * `informative_text`: The dialog's main message text. If the value is a +-- table, the first table value is the main message text and any subsequent +-- values are used as the labels for multiple entry boxes. Providing a +-- single label has no effect. +-- * `text`: The dialog's initial input text. If the value is a table, the +-- table values are used to populate the multiple entry boxes defined by +-- `informative_text`. -- * `no_cancel`: Do not display the "Cancel" button. The default value is -- `false`. -- * `string_output`: Return the selected button's label or the dialog's exit @@ -171,8 +181,13 @@ function standard_inputbox(options) end -- @param options Table of key-value option pairs for the input box. -- -- * `title`: The dialog's title text. --- * `informative_text`: The dialog's main message text. --- * `text`: The dialog's initial input text. +-- * `informative_text`: The dialog's main message text. If the value is a +-- table, the first table value is the main message text and any subsequent +-- values are used as the labels for multiple entry boxes. Providing a +-- single label has no effect. +-- * `text`: The dialog's initial input text. If the value is a table, the +-- table values are used to populate the multiple entry boxes defined by +-- `informative_text`. -- * `button1`: The right-most button's label. The default value is -- `_L['_OK']`. -- * `button2`: The middle button's label. @@ -201,8 +216,13 @@ function secure_inputbox(options) end -- @param options Table of key-value option pairs for the input box. -- -- * `title`: The dialog's title text. --- * `informative_text`: The dialog's main message text. --- * `text`: The dialog's initial input text. +-- * `informative_text`: The dialog's main message text. If the value is a +-- table, the first table value is the main message text and any subsequent +-- values are used as the labels for multiple entry boxes. Providing a +-- single label has no effect. +-- * `text`: The dialog's initial input text. If the value is a table, the +-- table values are used to populate the multiple entry boxes defined by +-- `informative_text`. -- * `no_cancel`: Do not display the "Cancel" button. The default value is -- `false`. -- * `string_output`: Return the selected button's label or the dialog's exit diff --git a/core/ui.lua b/core/ui.lua index dd0fd522..fa2d5d51 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -105,9 +105,13 @@ ui.dialogs = setmetatable({}, {__index = function(t, k) local files = {} for file in result:gmatch('[^\n]+') do files[#files + 1] = file end return files - elseif k == 'filteredlist' then + elseif k == 'filteredlist' or + k:find('input') and result:match('^[^\n]+\n?(.*)$'):find('\n') then local button, value = result:match('^([^\n]+)\n?(.*)$') if not options.string_output then button = tonumber(button) end + if k:find('input') then + options.string_output, options.select_multiple = true, true + end local items = {} for item in value:gmatch('[^\n]+') do items[#items + 1] = options.string_output and item or tonumber(item) + 1 |