Module tinyfiledialogs

Corona binding for tiny file dialogs, which provides various dialogs on desktop platforms.

To use the plugin, add the following in build.settings:

plugins = {
 ["plugin.tinyfiledialogs"] = { publisherId = "com.xibalbastudios" }
}

A sample may be found here.


Adapted from the original project:

tinyfiledialogs.h v2.9.3 [July 12, 2017] zlib licence

Copyright (c) 2014 - 2017 Guillaume Vareille http://ysengrin.com

http://tinyfiledialogs.sourceforge.net

git://git.code.sf.net/p/tinyfiledialogs/code

     ______________________________________________
    |                                              |
    |     email: tinyfiledialogs@ysengrin.com      |
    |______________________________________________|

Functions

colorChooser (opts) Create a dialog for choosing colors.
inputBox (opts) Create a dialog for text input.
messageBox (opts) Create a message dialog.
openFileDialog (opts) Create a dialog for choosing files to open.
saveFileDialog (opts) Create a dialog for choosing files to save.
selectFolderDialog (opts) Create a dialog for choosing a folder.


Functions

colorChooser (opts)
Create a dialog for choosing colors.

Parameters:

  • opts table

    Dialog options, which include:

    • title: Optional title, e.g. "Choose a color".
    • out_rgb: If present, a table whose r, g, and b values will be populated on success. These will describe the same color as the hex string, but as numbers in the 0-1 range.
    • rgb: If present, a table whose r, g, and b values must be numbers from 0 to 1, used as the initial color. This may be the same table as out_rgb.

Returns:

    string A hex string such as "#FF0000".

Or

    false, if the user cancelled.
inputBox (opts)
Create a dialog for text input.

In Corona native.newTextField will be more idiomatic, but this is provided for completeness.

Parameters:

  • opts table

    Dialog options, which include:

    • title: Optional title, e.g. "Messages are great...".
    • message: Optional message, e.g. "...aren't they?".
    • default_input: If this is false, the text will be hidden, password-style. Otherwise, this may be a string providing some initial text.

Returns:

    string Input text.

Or

    false, if the user cancelled.
messageBox (opts)
Create a message dialog.

In Corona native.showAlert will be more idiomatic, but this is provided for completeness.

Parameters:

  • opts table

    Dialog options, which include:

    • title: Optional title, e.g. "Enter some text".
    • message: Optional message, e.g. "Text is great".
    • dialog_type: One of "ok" (the default), "okcancel", and "yesno", determining the type of message box.
    • icon_type: One of "info" (the default), "warning", "error", and "question", determining the icon shown.
    • default_okyes: If this is true, the OK or Yes option will be the default, rather than Cancel or No. This is irrelevant if dialog_type was "ok".

Returns:

    boolean Was the OK or Yes option chosen?
openFileDialog (opts)
Create a dialog for choosing files to open.

Parameters:

  • opts table

    Dialog options, which include:

    • title: Optional title, e.g. "Choose SFX".
    • default_path_and_file: Optional path where dialog should start, e.g. system.pathForFile("MySFXFolder"); this may more specifically refer to a file, which will be initially selected, such as system.pathForFile("MySFXFolder/Hit.mp3").
    • filter_patterns: If absent, all files in the folder will be available for selection. Otherwise, this may be either a single string such as "*.mp3" or an array of them, e.g. { "*.mp3", "*.wav" }.
    • filter_description: Optional string used as a friendly replacement for any filter patterns, e.g. "Sound Effects".
    • allow_multiple_selects: If true, multiple files may be returned.

Returns:

    {string...} A list of file names.

Or

    string A single file name.

Or

    false, if the user cancelled.
saveFileDialog (opts)
Create a dialog for choosing files to save.

Parameters:

  • opts table

    Dialog options, which include:

    • title: Optional title, e.g. "Choose image".
    • default_path_and_file: Optional path where dialog should start looking, e.g. system.pathForFile("MyImageFolder"); this may more specifically refer to a file, which will be initially selected, such as system.pathForFile("MyImageFolder/Fire.png").
    • filter_patterns: If absent, all files in the folder will be available for selection. Otherwise, this may be either a single string such as "*.png" or an array of them, e.g. { "*.png", "*.jpg" }.
    • filter_description: Optional string used as a friendly replacement for any filter patterns, e.g. "Images".

Returns:

    string File name.

Or

    false, if the user cancelled.
selectFolderDialog (opts)
Create a dialog for choosing a folder.

Parameters:

  • opts table

    Dialog options, which include:

    • title: Optional title, e.g. "Choose image".
    • default_path: Optional path where dialog should start looking, e.g. system.pathForFile("MyImageFolder"). (N.B. Buggy?)

Returns:

    string Folder name.

Or

    false, if the user cancelled.
generated by LDoc 1.4.0