IupText

IUP - Portable User Interface

IupText

Creates an editable field with one line.

Creation

Ihandle* IupText(const char *action); [in C]
iup.text{} -> (elem: ihandle) [in Lua]
text(action) [in LED]

action: name of the action generated when the user types something. It can be NULL.

Returns: the identifier of the created element, or NULL if an error occurs.

Attributes

APPEND: Inserts a text at the end of the current text.

INSERT: Inserts a text in the caret's position.

BORDER: Shows a border around the text. Default: "YES".

NC: Maximum number of characters allowed. The maximum NC value is 231.

CARET: Position of the insertion point.

READONLY: Allows the user only to read the contents, without changing it. Possible values: "YES", "NO" (default).

SELECTION: Selection interval.

SELECTEDTEXT: Selection text.

SIZE: Text size. Default: room for 5 characters.  If EXPAND is set to NO, when the dialog is resized and the text SIZE is not set, then the text initial size will be set to display its contents as the default control size calculation in IUP. But if EXPAND is enabled then the text will not expand to its contents and it will respect the expansion of the dialog.

ALIGNMENT:  (Windows Only) Label's alignment. Possible values: "ALEFT", "ARIGHT", "ACENTER". Default: "ALEFT".

PASSWORD: (Windows Only) Hide the typed character using an "*".

CLIPBOARD [write-only]: cut, copy or paste the selection to or from the clipboard. Values: "CUT", "COPY" or "PASTE".

VALUE: Text entered by the user. If the element is already mapped, the string is directly copied to the native control (see IupMap).

The value can be any text, including '\n' characters indicating line change. Default: NULL when the element is not yet mapped; "" if it is.

Callbacks

ACTION: Action generated when a keyboard event occurs. The callback also receives the typed key.

int function(Ihandle *self, int c, char *after); [in C]
elem:action(c: number, after: string) -> (ret: number) [in Lua]

c: Identifier of the typed key. Please refer to the Keyboard Codes table for a list of possible values.
after: Represents the new text value in case the key is validated (i.e. the callback returns IUP_DEFAULT).

If the function returns IUP_IGNORE, the system will ignore the typed character. If the function returns the code of any other key, IUP will treat this new key instead of the one typed by the user.

CARET_CB: Action generated when the caret/cursor position is changed.

int function(Ihandle *self, int row, int col); [in C]
elem:caret_cb(row, col: number) -> (ret: number) [in Lua]

row, col: Row and collumn number.

Notes

Text is always left aligned.

On the Windows driver, the action callback is not called for the function keys (K_F???).

The IupMask control can be used to create a mask and filter the text entered by the user.

Examples

Browse Example Files

See Also

IupMultiLine