Module ui.widget.inputdialog

Widget for taking user input.

Example:

local UIManager = require("ui/uimanager")
local _ = require("gettext")
local sample_input
sample_input = InputDialog:new{
    title = _("Dialog title"),
    input = "default value",
    input_hint = "hint text",
    input_type = "string",
    description = "Some more description",
    -- text_type = "password",
    buttons = {
        {
            {
                text = _("Cancel"),
                callback = function()
                    UIManager:close(sample_input)
                end,
            },
            {
                text = _("Save"),
                -- button with is_enter_default set to true will be
                -- triggered after user press the enter key from keyboard
                is_enter_default = true,
                callback = function()
                    print('Got user input as raw text:', sample_input:getInputText())
                    print('Got user input as value:', sample_input:getInputValue())
                end,
            },
        }
    },
}
sample_input:onShowKeyboard()
UIManager:show(sample_input)

If it would take the user more than half a minute to recover from a mistake, a "Cancel" button must be added to the dialog. The cancellation button should be kept on the left and the button executing the action on the right.

It is strongly recommended to use a text describing the action to be executed, as demonstrated in the example above. If the resulting phrase would be longer than three words it should just read "OK".



generated by LDoc 1.4.6 Last updated 2017-10-08 14:57:40