utils.inputbox

Display a message box and get free-format reply

Prototype

result = utils.inputbox ( msg, title, default, font, fontsize, extras )

Description

This lets you display a Windows message box and accept a free-format reply (very similar to InputBox in VBscript). The intention is to allow you to display (in a small dialog box) a question and accept a typed response.

The calling sequence is:

result = utils.inputbox ( msg, title, default, font, fontsize, extras )
The only required argument is the message text itself. The extra parameters (if supplied) is a table which can consist of one or more of: Examples of the extra parameters can be found here:

http://gammon.com.au/forum/?id=10644

The validate function (if used) should be a Lua function that takes a single argument (which is what was typed into the input box) and returns true if this reply was acceptable, and false if not. For example, you might return true if the reply was numeric, if a number was required. This function is called when they click the OK button.

Return value = what they typed, or nil if cancelled

Example:

print (utils.inputbox ("What is your name?", "Query", "Nick", "Courier", 9)) --> Peter
There is also similar function which will handle a larger response: utils.editbox

Lua functions

Topics