Difference between revisions of "IUP/Controls/IupList"

From Vendetta Lua
Jump to: navigation, search
(Created page with "__NOTOC__ __NOEDITSECTION__ 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...")
 
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
 +
{{IUP Controls}}
 
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.
 
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===
 
===Creation===
:iup.list{} -> ('''elem''': ihandle)
+
    iup.list{} -> ('''elem''': ihandle)
 +
 
 
:This function returns the identifier of the created list, or nil if an error occurs.
 
:This function returns the identifier of the created list, or nil if an error occurs.
  
Line 34: Line 36:
 
:'''MARGINX''':  
 
:'''MARGINX''':  
 
:'''MARGINY''':
 
:'''MARGINY''':
:'''IMAGE''':
+
:'''[[IUP/Attributes/IMAGE|IMAGE]]''':
 
:'''BORDERCOLOR''':
 
:'''BORDERCOLOR''':
 
:'''FOCUSEDBORDERCOLOR''':
 
:'''FOCUSEDBORDERCOLOR''':
 
:'''SELCOLOR''':
 
:'''SELCOLOR''':
 
:'''UNFOCUSEDSELCOLOR''':
 
:'''UNFOCUSEDSELCOLOR''':
:'''CONTROL''': = "YES" or "NO"
+
:'''CONTROL''': Changes the list to be a list of controls. Possible values: "YES", "NO" (Default: "NO")
  
 
===Callbacks===
 
===Callbacks===
 
:[[IUP/Callbacks/ACTION|ACTION]]: Action generated when the state of an item in the list is changed. Also provides information on the changed item:
 
:[[IUP/Callbacks/ACTION|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)
+
        elem:action('''t''': string, '''i''', '''v''': number) -> (ret: number)
  
 
::'''t''': Text of the changed item.
 
::'''t''': Text of the changed item.
Line 50: Line 52:
 
::'''v''': Equal to 1 if the option was selected or to 0 if the option was deselected.
 
::'''v''': Equal to 1 if the option was selected or to 0 if the option was deselected.
  
:[[IUP/Callbacks/GETFOCUS_CB|GETFOCUS_CB]]: -- when not dropdown and not multiple, each selection
+
:[[IUP/Callbacks/GETFOCUS_CB|GETFOCUS_CB]]: When DROPDOWN = "NO" and MULTIPLE = "NO" then this event will trigger on each selection.
:[[IUP/Callbacks/KILLFOCUS_CB|KILLFOCUS_CB]]: -- when not dropdown and not multiple
+
:[[IUP/Callbacks/KILLFOCUS_CB|KILLFOCUS_CB]]: When DROPDOWN = "NO" and MULTIPLE = "NO" then this event will trigger on each selection.
  
 
===Notes===
 
===Notes===
  
 
:Text is always left aligned.
 
: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===
 
===See Also===
  
 
:[[IUP/Controls/IupText|IupText]]
 
:[[IUP/Controls/IupText|IupText]]
 +
 +
[[Category:IUP Controls]]

Latest revision as of 21:26, 11 May 2023


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