IUP/Controls/IupList

From Vendetta Lua
Jump to navigationJump to search


Controls

Dialog
Fill
Hbox
Vbox
Zbox
Cbox
Radio
Button
Canvas
Frame
Label
List
Multiline
Text
Toggle
Progress Bar
Matrix
Tree
Navmap

Creates a list interface element, which is a list of two-state (on or off) items. An action is generated when an event changes the state of an item.

Creation

   iup.list{} -> (elem: ihandle)
This function returns the identifier of the created list, or nil if an error occurs.

Attributes

"1": First item in the list.
"2": Second item in the list.
"3": Third item in the list.
...'
"n": nth item in the list.
The values can be any text. Default: nil. The first element with a nil is considered the end of the list.
DROPDOWN: Changes the appearance of the list for the user: only the selected item is shown beside a button with the image of an arrow pointing down. Creation-only attribute. Can be "YES" or "NO". Default "NO".
VISIBLE_ITEMS: Number of items that appear when a DROPDOWN list is activated. Default: Depends on the native system.
MULTIPLE: Allows selecting several items simultaneously (multiple list). Default: "NO". Creation only attribute in Windows. Valid only for simple lists with no edit box.
SIZE: Size of the list. Default: room for 5 characters in 1 item.
FONT: Font size of the text.
VALUE: Depends on the list type:
Simple list: Integer number representing the selected element in the list (begins at 1). It can be zero if there is no selected item.
Multiple list: Sequence of '+' and '-' symbols indicating the state of each item. When setting this value, the user must provide the same amount of '+' and '-' symbols as the amount of items in the list, otherwise the specified items will be deselected.
MARGINX:
MARGINY:
IMAGE:
BORDERCOLOR:
FOCUSEDBORDERCOLOR:
SELCOLOR:
UNFOCUSEDSELCOLOR:
CONTROL: Changes the list to be a list of controls. Possible values: "YES", "NO" (Default: "NO")

Callbacks

ACTION: Action generated when the state of an item in the list is changed. Also provides information on the changed item:
       elem:action(t: string, i, v: number) -> (ret: number)
t: Text of the changed item.
i: Number of the changed item.
v: Equal to 1 if the option was selected or to 0 if the option was deselected.
GETFOCUS_CB: When DROPDOWN = "NO" and MULTIPLE = "NO" then this event will trigger on each selection.
KILLFOCUS_CB: When DROPDOWN = "NO" and MULTIPLE = "NO" then this event will trigger on each selection.

Notes

Text is always left aligned.
When CONTROL = "YES", the list is comprised of controls instead of text. The first index (element[1]) should be nil when modifying the list contents and 1 when it is in use. Each inserted control should be an IupDialog containing all of the other control elements to be displayed.

See Also

IupText