I have had some queries about the functions utils.inputbox and utils.editbox which used to display a fixed-size dialog box. This tended to look a bit flaky if you just wanted to ask the user to enter a small amount of data, when the dialog was actually quite large.
Now those two functions have a sixth argument, which is a table of "extra" information. These fields are named:
[EDIT] Also added (see post further down):
[EDIT] Also added in version 4.73:
So for example:
Options which are omitted try to default to reasonable values.
The box width and height control the overall dialog box size.
The prompt width and height are the size of the field which prompts for the response. So if you have a short question you might make the prompt height small (like, 12).
The reply width and height are the size of the box into which you type the response.
The field "max_length" controls the maximum number of characters you can type into the field. So for example, if you are asking for a character name, and the maximum name is 12 characters, you could put 12 there.
This functionality is in version 4.64 onwards.
Now those two functions have a sixth argument, which is a table of "extra" information. These fields are named:
- box_width --> width of message box in pixels (min 180)
- box_height --> height of message box in pixels (min 125)
- prompt_width --> width of prompt text in pixels (min 10)
- prompt_height --> height of prompt text in pixels (min 12)
- reply_width --> width of reply in pixels (min 10)
- reply_height --> height of reply in pixels (min 10)
- max_length --> max characters they can type (min 1)
[EDIT] Also added (see post further down):
- validate --> validation function
- ok_button --> label for "OK" button
- cancel_button --> label for "Cancel" button
[EDIT] Also added in version 4.73:
- read_only --> text-entry area is read-only
- ok_button_width --> width of "OK" button
- cancel_button_width --> width of "Cancel" button
So for example:
result = utils.inputbox ( "Enter the room number", -- prompt
"Room", -- window title
"1234", -- default answer
"Courier", 10, -- font
{
box_width = 180,
box_height = 125,
prompt_width = 150,
prompt_height = 12,
reply_width = 80,
reply_height = 10,
max_length = 5,
}
)
Options which are omitted try to default to reasonable values.
The box width and height control the overall dialog box size.
The prompt width and height are the size of the field which prompts for the response. So if you have a short question you might make the prompt height small (like, 12).
The reply width and height are the size of the box into which you type the response.
The field "max_length" controls the maximum number of characters you can type into the field. So for example, if you are asking for a character name, and the maximum name is 12 characters, you could put 12 there.
This functionality is in version 4.64 onwards.