- Setters that accept
FCString
will also accept a Luastring
ornumber
. FCString
parameter in getters is optional and if omitted, the result will be returned as a Luastring
.- Setters that accept
FCStrings
will also accept multiple arguments ofFCString
, Luastring
, ornumber
. - Added numerous methods for accessing and modifying listbox items.
- Added
SelectionChange
custom control event. - Added hooks into control state preservation.
- Init(self)
- StoreState(self)
- RestoreState(self)
- Clear(self)
- GetCount(self)
- GetSelectedItem(self)
- SetSelectedItem(self, index)
- SetSelectedLast(self)
- HasSelection(self)
- ItemExists(self, index)
- AddString(self, str)
- AddStringLocalized(self)
- AddStrings(self)
- AddStringsLocalized(self)
- GetStrings(self, strs)
- SetStrings(self)
- GetItemText(self, index, str)
- SetItemText(self, index, str)
- GetSelectedString(self, str)
- SetSelectedString(self, str)
- InsertItem(self, index, str)
- DeleteItem(self, index)
- HandleSelectionChange(control, last_item, last_item_text, is_deleted)
- AddHandleSelectionChange(self, callback)
- RemoveHandleSelectionChange(self, callback)
fcmctrllistbox.Init(self)
[Internal]
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.StoreState(self)
[Fluid] [Internal] [Override]
Override Changes:
- Stores
FCMCtrlListBox
-specific properties.
Do not disable this method. Override as needed but call the parent first.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.RestoreState(self)
[Fluid] [Internal] [Override]
Override Changes:
- Restores
FCMCtrlListBox
-specific properties.
Do not disable this method. Override as needed but call the parent first.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.Clear(self)
[Fluid] [Override]
Override Changes:
- Ensures that
SelectionChange
event is triggered. - Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.GetCount(self)
[Override]
Override Changes:
- Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
Return type | Description |
---|---|
number |
fcmctrllistbox.GetSelectedItem(self)
[Override]
Override Changes:
- Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
Return type | Description |
---|---|
number |
fcmctrllistbox.SetSelectedItem(self, index)
[Fluid] [Override]
Override Changes:
- Ensures that
SelectionChange
event is triggered. - Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
index |
number |
fcmctrllistbox.SetSelectedLast(self)
[Override]
Override Changes:
- Ensures that
SelectionChange
event is triggered. - Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
Return type | Description |
---|---|
boolean |
true if a selection was possible. |
fcmctrllistbox.HasSelection(self)
Checks if the popup has a selection. If the parent window does not exist (ie WindowExists() == false
), this result is theoretical.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
Return type | Description |
---|---|
boolean |
true if something is selected, false if no selection. |
fcmctrllistbox.ItemExists(self, index)
Checks if there is an item at the specified index.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
index |
number |
0-based item index. |
Return type | Description |
---|---|
boolean |
true if the item exists, false if it does not exist. |
fcmctrllistbox.AddString(self, str)
[Fluid] [Override]
Override Changes:
- Accepts Lua
string
ornumber
in addition toFCString
. - Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
str |
FCString | string | number |
fcmctrllistbox.AddStringLocalized(self)
[Fluid]
Localized version of AddString
.
@ key (string | FCString, number) The key into the localization table. If there is no entry in the appropriate localization table, the key is the text.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.AddStrings(self)
[Fluid]
Adds multiple strings to the list box.
@ ... (FCStrings | FCString | string | number | table)
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.AddStringsLocalized(self)
[Fluid]
Adds multiple localized strings to the combobox.
@ ... (FCStrings | FCString | string | number) keys of strings to be added. If no localization is found, the key is added.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.GetStrings(self, strs)
[?Fluid]
Returns a copy of all strings in the list box.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
strs (optional) |
FCStrings |
An optional FCStrings object to populate with strings. |
Return type | Description |
---|---|
table |
If strs is omitted, a table of strings (1-indexed - beware if accessing by key!). |
fcmctrllistbox.SetStrings(self)
[Fluid] [Override]
Override Changes:
- Accepts multiple arguments.
- Accepts
FCString
, Luastring
ornumber
in addition toFCStrings
. - Hooks into control state preservation.
@ ... (FCStrings | FCString | string | number) number
s will be automatically cast to string
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
fcmctrllistbox.GetItemText(self, index, str)
[?Fluid]
Returns the text for an item in the list box.
This method works in all JW/RGP Lua versions and irrespective of whether InitWindow
has been called.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
index |
number |
0-based index of item. |
str (optional) |
FCString |
Optional FCString object to populate with text. |
Return type | Description |
---|---|
string |
Returned if str is omitted. |
fcmctrllistbox.SetItemText(self, index, str)
[Fluid] [Override]
Override Changes:
- Added polyfill for JWLua.
- Is valid irrespective of whether
InitWindow
has been called. - Hooks into control state preservation.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
index |
number |
0-based index of item. |
str |
FCString | string | number |
fcmctrllistbox.GetSelectedString(self, str)
[?Fluid]
Returns the text for the item that is currently selected.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
str (optional) |
FCString |
Optional FCString object to populate with text. If no item is currently selected, it will be populated with an empty string. |
Return type | Description |
---|---|
string \| nil |
Returned if str is omitted. nil if no item is selected. |
fcmctrllistbox.SetSelectedString(self, str)
[Fluid]
Sets the currently selected item to the first item with a matching text value. If no match is found, the current selected item will remain selected. Matches are case-sensitive.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
str |
FCString | string | number |
fcmctrllistbox.InsertItem(self, index, str)
[Fluid] [PDKPort]
Inserts a string at the specified index. If index is <= 0, will insert at the start. If index is >= GetCount(), will insert at the end.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
index |
number |
0-based index to insert new item. |
str |
FCString | string | number |
The value to insert. |
fcmctrllistbox.DeleteItem(self, index)
[Fluid] [PDK Port] Deletes an item from the list box. If the currently selected item is deleted, items will be deselected (ie set to -1)
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
index |
number |
0-based index of item to delete. |
fcmctrllistbox.HandleSelectionChange(control, last_item, last_item_text, is_deleted)
[Callback Template]
Input | Type | Description |
---|---|---|
control |
FCMCtrlListBox |
|
last_item |
number |
The 0-based index of the previously selected item. If no item was selected, the value will be -1 . |
last_item_text |
string |
The text value of the previously selected item. |
is_deleted |
boolean |
true if the previously selected item is no longer in the control. |
fcmctrllistbox.AddHandleSelectionChange(self, callback)
[Fluid]
Adds a handler for SelectionChange events. If the selected item is changed by a handler, that same handler will not be called again for that change.
The event will fire in the following cases:
- When the window is created (if an item is selected)
- Change in selected item by user or programatically (inserting an item before or after will not trigger the event)
- Changing the text value of the currently selected item
- Deleting the currently selected item
- Clearing the control (including calling
Clear
andSetStrings
)
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
callback |
function |
See HandleSelectionChange for callback signature. |
fcmctrllistbox.RemoveHandleSelectionChange(self, callback)
[Fluid]
Removes a handler added with AddHandleSelectionChange
.
Input | Type | Description |
---|---|---|
self |
FCMCtrlListBox |
|
callback |
function |
Handler to remove. |