IupScanf

Shows a modal dialog for capturing values with a format similar to the scanf function in the C stdio library.

It is recommended that new applications use the IupGetParam dialog instead.

Creation and Show

int IupScanf(const char *format, ...); [in C]
iup.Scanf(format: string, ...) -> (...) [in Lua]

format: Reading format
...: List of variables

Returns: In C the number of successfully read fields, or -1 when the user has canceled the operation. In Lua, the code is not returned, the values are returned by the function in the same order they were passed, or nil when the user has canceled the operation.

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 text field in a label.
t is the maximum number of characters allowed
v is the number of visible characters in the text field
f is the type (char, float, etc), in the C format for I/O services (d,i,o,u,x,X,e,f,g,E,G,s, and the modifiers l,h)

All 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.

Browse for Example Files

See Also

IupGetFile, IupMessage, IupListDialog, IupAlarm, IupGetParam