IUP/Controls/IupText: Difference between revisions
From Vendetta Lua
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
{{IUP Controls}} | |||
Creates an editable field with one line. | Creates an editable field with one line. | ||
===Creation=== | ===Creation=== | ||
iup.text{} -> ('''elem''': ihandle) | |||
:This function returns the identifier of the created text, nil if an error occurs. | :This function returns the identifier of the created text, nil if an error occurs. | ||
Line 16: | Line 17: | ||
:'''BORDER''': Shows a border around the text. Default: "YES". | :'''BORDER''': Shows a border around the text. Default: "YES". | ||
:'''BORDERCOLOR''': | |||
:'''[[IUP/Attributes/NC|NC]]''': Maximum number of characters allowed. | :'''[[IUP/Attributes/NC|NC]]''': Maximum number of characters allowed. | ||
Line 24: | Line 27: | ||
:'''[[IUP/Attributes/SIZE|SIZE]]''': Text size. Default: room for 5 characters. | :'''[[IUP/Attributes/SIZE|SIZE]]''': Text size. Default: room for 5 characters. | ||
:'''PASSWORD''': Hide the typed character using an "*". | :'''PASSWORD''': Hide the typed character using an "*". | ||
:'''VALUE''': Text entered by the user. If the element is already mapped, the string is directly copied to the native control (see IupMap). | :'''VALUE''': Text entered by the user. If the element is already mapped, the string is directly copied to the native control (see IupMap). | ||
:'''WANTTAB''': Possible values: "YES", "NO" | |||
:'''DONT_RECURSE''' | |||
:'''POINTSIZE''': Possible values: "YES", "NO" | |||
:'''MOUSEOVERBOXCOLOR''': The color of the element when it is selected or the mouse hovers over it. | |||
:'''BOXCOLOR''': Unselected box element color. | |||
:'''[[IUP/Attributes/MARGINX|MARGINX]]''' | |||
:'''[[IUP/Attributes/MARGINY|MARGINY]]''' | |||
:'''[[IUP/Attributes/IMAGE|IMAGE]]''' | |||
::The value can be any text, including '\n' characters indicating line change. Default: nil when the element is not yet mapped; "" if it is. | ::The value can be any text, including '\n' characters indicating line change. Default: nil when the element is not yet mapped; "" if it is. | ||
Line 37: | Line 54: | ||
:[[IUP/Callbacks/ACTION|ACTION]]: Action generated when a keyboard event occurs. The callback also receives the typed key. | :[[IUP/Callbacks/ACTION|ACTION]]: Action generated when a keyboard event occurs. The callback also receives the typed key. | ||
elem:action('''c''': number, '''after''': string) -> (ret: number) | |||
::'''c''': Identifier of the typed key. Please refer to the Keyboard Codes table for a list of possible values. | ::'''c''': Identifier of the typed key. Please refer to the Keyboard Codes table for a list of possible values. | ||
Line 43: | Line 60: | ||
::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. | ::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. | ||
:[[IUP/Attributes/GETFOCUS_CB|GETFOCUS_CB]] | |||
:[[IUP/Attributes/KILLFOCUS_CB|KILLFOCUS_CB]] | |||
:[[IUP/Attributes/ENTERWINDOW_CB|ENTERWINDOW_CB]] | |||
:[[IUP/Attributes/LEAVEWINDOW_CB|LEAVEWINDOW_CB]] | |||
===Notes=== | ===Notes=== | ||
Line 48: | Line 73: | ||
:Text is always left aligned. | :Text is always left aligned. | ||
: | :The action callback is not called for the function keys (K_F???). '''(check)''' | ||
===See Also=== | ===See Also=== | ||
:[[IUP/Controls/IupMultiLine|IupMultiLine]] | :[[IUP/Controls/IupMultiLine|IupMultiLine]] | ||
[[Category:IUP Controls]] |
Revision as of 22:04, 11 May 2023
Controls |
Dialog |
Creates an editable field with one line.
Creation
iup.text{} -> (elem: ihandle)
- This function returns the identifier of the created text, nil 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".
- BORDERCOLOR:
- NC: Maximum number of characters allowed.
- CARET: Position of the insertion point.
- READONLY: Allows the user only to read the contents, without changing it. Possible values: "YES", "NO" (default).
- SIZE: Text size. Default: room for 5 characters.
- PASSWORD: Hide the typed character using an "*".
- VALUE: Text entered by the user. If the element is already mapped, the string is directly copied to the native control (see IupMap).
- WANTTAB: Possible values: "YES", "NO"
- DONT_RECURSE
- POINTSIZE: Possible values: "YES", "NO"
- MOUSEOVERBOXCOLOR: The color of the element when it is selected or the mouse hovers over it.
- BOXCOLOR: Unselected box element color.
- The value can be any text, including '\n' characters indicating line change. Default: nil 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.
elem:action(c: number, after: string) -> (ret: number)
- 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.
Notes
- Text is always left aligned.
- The action callback is not called for the function keys (K_F???). (check)