IUP/Controls/IupList
From Vendetta Lua
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: = "YES" or "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 not dropdown and not multiple, each selection
- KILLFOCUS_CB: -- when not dropdown and not multiple
Notes
- Text is always left aligned.