Summary of modifications:
- Setters that accept
FCString
now also accept Lua string
and number
.
- In getters with an
FCString
parameter, the parameter is now optional and a Lua string
is returned.
- Setters that accept
FCStrings
now also accept multiple arguments of FCString
, Lua string
, or number
.
- Numerous additional methods for accessing and modifying popup items.
- Added
SelectionChange
custom control event.
- Added hooks for restoring control state
Functions
- Init(self)
- StoreState(self)
- RestoreState(self)
- Clear(self)
- GetCount(self)
- GetSelectedItem(self)
- SetSelectedItem(self, index)
- SetSelectedLast(self)
- IsItemSelected(self)
- ItemExists(self, index)
- AddString(self, str)
- AddStrings(self)
- GetStrings(self, strs)
- SetStrings(self)
- GetItemText(self, index, str)
- SetItemText(self, index, str)
- GetSelectedString(self, str)
- SetSelectedString(self, str)
- InsertString(self, index, str)
- DeleteItem(self, index)
- HandleSelectionChange(control, last_item, last_item_text, is_deleted)
- AddHandleSelectionChange(self, callback)
- RemoveHandleSelectionChange(self, callback)
Init
fcmctrlpopup.Init(self)
View source
[Internal]
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
StoreState
fcmctrlpopup.StoreState(self)
View source
[Fluid] [Internal] [Override]
Stores the control’s current state.
Do not disable this method. Override as needed but call the parent first.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
RestoreState
fcmctrlpopup.RestoreState(self)
View source
[Fluid] [Internal] [Override]
Restores the control’s stored state.
Do not disable this method. Override as needed but call the parent first.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
Clear
fcmctrlpopup.Clear(self)
View source
[Fluid] [Override]
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
GetCount
fcmctrlpopup.GetCount(self)
View source
[Override]
Hooks into control state restoration.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
Return type |
Description |
number |
|
GetSelectedItem
fcmctrlpopup.GetSelectedItem(self)
View source
[Override]
Hooks into control state restoration.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
Return type |
Description |
number |
|
SetSelectedItem
fcmctrlpopup.SetSelectedItem(self, index)
View source
[Fluid] [Override]
Ensures that SelectionChange is triggered.
Also hooks into control state restoration.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
index |
number |
|
SetSelectedLast
fcmctrlpopup.SetSelectedLast(self)
View source
[Fluid]
Selects the last item in the popup. If popup is empty, will be set to -1.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
IsItemSelected
fcmctrlpopup.IsItemSelected(self)
View source
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 |
FCMCtrlPopup |
|
Return type |
Description |
boolean |
true if something is selected, false if no selection. |
ItemExists
fcmctrlpopup.ItemExists(self, index)
View source
Checks if there is an item at the specified index.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
index |
number |
0-based item index. |
Return type |
Description |
boolean |
true if the item exists, false if it does not exist. |
AddString
fcmctrlpopup.AddString(self, str)
View source
[Fluid] [Override]
Accepts Lua string
and number
in addition to FCString
.
Also hooks into control state restoration.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
str |
`FCString |
string |
AddStrings
fcmctrlpopup.AddStrings(self)
View source
[Fluid]
Adds multiple strings to the popup.
@ … (FCStrings|FCString|string|number)
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
GetStrings
fcmctrlpopup.GetStrings(self, strs)
View source
Returns a copy of all strings in the popup.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
strs (optional) |
FCStrings |
An optional FCStrings object to populate with strings. |
Return type |
Description |
table |
A table of strings (1-indexed - beware when accessing by key!). |
SetStrings
fcmctrlpopup.SetStrings(self)
View source
[Fluid] [Override]
Accepts multiple arguments.
@ … (FCStrings|FCString|string|number) number
s will be automatically cast to string
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
GetItemText
fcmctrlpopup.GetItemText(self, index, str)
View source
Returns the text for an item in the popup.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
index |
number |
0-based index of item. |
str (optional) |
FCString |
Optional FCString object to populate with text. |
Return type |
Description |
string|nil |
nil if the item doesn’t exist |
SetItemText
fcmctrlpopup.SetItemText(self, index, str)
View source
[Fluid] [PDK Port]
Sets the text for an item.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
index |
number |
0-based index of item. |
str |
`FCString |
string |
GetSelectedString
fcmctrlpopup.GetSelectedString(self, str)
View source
Returns the text for the item that is currently selected.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
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 |
nil if no item is currently selected. |
SetSelectedString
fcmctrlpopup.SetSelectedString(self, str)
View source
[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. Matching is case-sensitive.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
str |
`FCString |
string |
InsertString
fcmctrlpopup.InsertString(self, index, str)
View source
[Fluid] [PDKPort]
Inserts a string at the specified index.
If index is <= 0, will insert at the start.
If index is >= Count, will insert at the end.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
index |
number |
0-based index to insert new item. |
str |
`FCString |
string |
DeleteItem
fcmctrlpopup.DeleteItem(self, index)
View source
[Fluid] [PDK Port]
Deletes an item from the popup.
If the currently selected item is deleted, items will be deselected (ie set to -1)
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
index |
number |
0-based index of item to delete. |
HandleSelectionChange
fcmctrlpopup.HandleSelectionChange(control, last_item, last_item_text, is_deleted)
View source
[Callback Template]
Input |
Type |
Description |
control |
FCMCtrlPopup |
|
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. |
AddHandleSelectionChange
fcmctrlpopup.AddHandleSelectionChange(self, callback)
View source
[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
and SetStrings
)
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
callback |
function |
See HandleSelectionChange for callback signature. |
RemoveHandleSelectionChange
fcmctrlpopup.RemoveHandleSelectionChange(self, callback)
View source
[Fluid]
Removes a handler added with AddHandleSelectionChange
.
Input |
Type |
Description |
self |
FCMCtrlPopup |
|
callback |
function |
Handler to remove. |