IupScanf
Shows a modal dialog for capturing values with a format similar to the scanf function in the C stdio library.
Creation and Show
int IupScanf(char *fmt, ...); [in C] IupScanf(fmt: string, ...) -> (n: number, ...) [in IupLua3] iup.Scanf(fmt: string, ...) -> (n: number, ...) [in IupLua5]fmt: Reading format
...: List of variables
This function returns the number of successfully read fields, or -1 when the user has canceled the operation.
In Lua, the values are returned by the function in the same order they were passed.
Notes
The fmt format must include a title and the descriptions of the variable fields to be read, using the following syntax:
- First line: Window title followed by '\n'
- Following lines: Must be specified for each variable to be read, in the following format:
"text%t.v%f\n", where:
text is a descriptive text, to be placed to the left of the entry field in a label.
t is the maximum number of characters allowed
v is the maximum number of visible characters in the entry field
f is the type (char, float, etc.), in the C format for I/O servicesAll the fields use a text box for input. If you need better control of what characters the user enters, you should use IupGetParam. This other dialog also has many other resources not available in IupScanf.
The dialog uses a global attribute called "PARENTDIALOG" as the parent dialog if it is defined. It also uses a global attribute called "ICON" as the dialog icon if it is defined.
Examples
Captures an integer number, a floating-point value and a character string.
See Also
IupGetFile, IupMessage, IupListDialog, IupAlarm, IupGetParam