@@ -6,13 +6,20 @@ Summary of modifications:
66- Setters that accept ` FCStrings ` now also accept multiple arguments of ` FCString ` , Lua ` string ` , or ` number ` .
77- Numerous additional methods for accessing and modifying listbox items.
88- Added ` SelectionChange ` custom control event.
9+ - Added hooks for restoring control state
910
1011## Functions
1112
1213- [ Init(self)] ( #init )
14+ - [ StoreState(self)] ( #storestate )
15+ - [ RestoreState(self)] ( #restorestate )
1316- [ Clear(self)] ( #clear )
17+ - [ GetCount(self)] ( #getcount )
18+ - [ GetSelectedItem(self)] ( #getselecteditem )
1419- [ SetSelectedItem(self, index)] ( #setselecteditem )
1520- [ SetSelectedLast(self)] ( #setselectedlast )
21+ - [ IsItemSelected(self)] ( #isitemselected )
22+ - [ ItemExists(self, index)] ( #itemexists )
1623- [ AddString(self, str)] ( #addstring )
1724- [ AddStrings(self)] ( #addstrings )
1825- [ GetStrings(self, strs)] ( #getstrings )
@@ -33,38 +40,109 @@ Summary of modifications:
3340fcmctrllistbox .Init (self )
3441```
3542
36- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L32 )
43+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L33 )
3744
3845** [ Internal] **
3946
4047| Input | Type | Description |
4148| ----- | ---- | ----------- |
4249| ` self ` | ` FCMCtrlListBox ` | |
4350
51+ ### StoreState
52+
53+ ``` lua
54+ fcmctrllistbox .StoreState (self )
55+ ```
56+
57+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L48 )
58+
59+ ** [ Fluid] [ Internal] [ Override] **
60+ Stores the control's current state.
61+ Do not disable this method. Override as needed but call the parent first.
62+
63+ | Input | Type | Description |
64+ | ----- | ---- | ----------- |
65+ | ` self ` | ` FCMCtrlListBox ` | |
66+
67+ ### RestoreState
68+
69+ ``` lua
70+ fcmctrllistbox .RestoreState (self )
71+ ```
72+
73+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L62 )
74+
75+ ** [ Fluid] [ Internal] [ Override] **
76+ Restores the control's stored state.
77+ Do not disable this method. Override as needed but call the parent first.
78+
79+ | Input | Type | Description |
80+ | ----- | ---- | ----------- |
81+ | ` self ` | ` FCMCtrlListBox ` | |
82+
4483### Clear
4584
4685``` lua
4786fcmctrllistbox .Clear (self )
4887```
4988
50- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L43 )
89+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L81 )
5190
5291** [ Fluid] [ Override] **
5392
5493| Input | Type | Description |
5594| ----- | ---- | ----------- |
5695| ` self ` | ` FCMCtrlListBox ` | |
5796
97+ ### GetCount
98+
99+ ``` lua
100+ fcmctrllistbox .GetCount (self )
101+ ```
102+
103+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L106 )
104+
105+ ** [ Override] **
106+ Hooks into control state restoration.
107+
108+ | Input | Type | Description |
109+ | ----- | ---- | ----------- |
110+ | ` self ` | ` FCMCtrlListBox ` | |
111+
112+ | Return type | Description |
113+ | ----------- | ----------- |
114+ | ` number ` | |
115+
116+ ### GetSelectedItem
117+
118+ ``` lua
119+ fcmctrllistbox .GetSelectedItem (self )
120+ ```
121+
122+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L123 )
123+
124+ ** [ Override] **
125+ Hooks into control state restoration.
126+
127+ | Input | Type | Description |
128+ | ----- | ---- | ----------- |
129+ | ` self ` | ` FCMCtrlListBox ` | |
130+
131+ | Return type | Description |
132+ | ----------- | ----------- |
133+ | ` number ` | |
134+
58135### SetSelectedItem
59136
60137``` lua
61138fcmctrllistbox .SetSelectedItem (self , index )
62139```
63140
64- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L65 )
141+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L141 )
65142
66143** [ Fluid] [ Override] **
67- Ensures that ` SelectionChange ` is triggered.
144+ Ensures that SelectionChange is triggered.
145+ Also hooks into control state restoration.
68146
69147| Input | Type | Description |
70148| ----- | ---- | ----------- |
@@ -77,7 +155,7 @@ Ensures that `SelectionChange` is triggered.
77155fcmctrllistbox .SetSelectedLast (self )
78156```
79157
80- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L82 )
158+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L162 )
81159
82160** [ Override] **
83161Ensures that ` SelectionChange ` is triggered.
@@ -90,13 +168,50 @@ Ensures that `SelectionChange` is triggered.
90168| ----------- | ----------- |
91169| ` boolean ` | ` true ` if a selection was possible. |
92170
171+ ### IsItemSelected
172+
173+ ``` lua
174+ fcmctrllistbox .IsItemSelected (self )
175+ ```
176+
177+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L185 )
178+
179+ Checks if the popup has a selection. If the parent window does not exist (ie ` WindowExists() == false ` ), this result is theoretical.
180+
181+ | Input | Type | Description |
182+ | ----- | ---- | ----------- |
183+ | ` self ` | ` FCMCtrlListBox ` | |
184+
185+ | Return type | Description |
186+ | ----------- | ----------- |
187+ | ` boolean ` | ` true ` if something is selected, ` false ` if no selection. |
188+
189+ ### ItemExists
190+
191+ ``` lua
192+ fcmctrllistbox .ItemExists (self , index )
193+ ```
194+
195+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L198 )
196+
197+ Checks if there is an item at the specified index.
198+
199+ | Input | Type | Description |
200+ | ----- | ---- | ----------- |
201+ | ` self ` | ` FCMCtrlListBox ` | |
202+ | ` index ` | ` number ` | 0-based item index. |
203+
204+ | Return type | Description |
205+ | ----------- | ----------- |
206+ | ` boolean ` | ` true ` if the item exists, ` false ` if it does not exist. |
207+
93208### AddString
94209
95210``` lua
96211fcmctrllistbox .AddString (self , str )
97212```
98213
99- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L97 )
214+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L214 )
100215
101216** [ Fluid] [ Override] **
102217
@@ -113,7 +228,7 @@ Accepts Lua `string` and `number` in addition to `FCString`.
113228fcmctrllistbox .AddStrings (self )
114229```
115230
116- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L120 )
231+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L239 )
117232
118233** [ Fluid] **
119234Adds multiple strings to the list box.
@@ -130,7 +245,7 @@ Adds multiple strings to the list box.
130245fcmctrllistbox .GetStrings (self , strs )
131246```
132247
133- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L144 )
248+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L263 )
134249
135250Returns a copy of all strings in the list box.
136251
@@ -149,7 +264,7 @@ Returns a copy of all strings in the list box.
149264fcmctrllistbox .SetStrings (self )
150265```
151266
152- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L167 )
267+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L286 )
153268
154269** [ Fluid] [ Override] **
155270Accepts multiple arguments.
@@ -166,7 +281,7 @@ Accepts multiple arguments.
166281fcmctrllistbox .GetItemText (self , index , str )
167282```
168283
169- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L202 )
284+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L323 )
170285
171286Returns the text for an item in the list box.
172287This method works in all JW/RGP Lua versions and irrespective of whether ` InitWindow ` has been called.
@@ -187,7 +302,7 @@ This method works in all JW/RGP Lua versions and irrespective of whether `InitWi
187302fcmctrllistbox .SetItemText (self , index , str )
188303```
189304
190- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L227 )
305+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L348 )
191306
192307** [ Fluid] [ PDK Port] **
193308Sets the text for an item.
@@ -204,7 +319,7 @@ Sets the text for an item.
204319fcmctrllistbox .GetSelectedString (self , str )
205320```
206321
207- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L265 )
322+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L395 )
208323
209324Returns the text for the item that is currently selected.
210325
@@ -223,12 +338,11 @@ Returns the text for the item that is currently selected.
223338fcmctrllistbox .SetSelectedString (self , str )
224339```
225340
226- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L296 )
341+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L425 )
227342
228343** [ Fluid] **
229344Sets the currently selected item to the first item with a matching text value.
230-
231- If no match is found, the current selected item will remain selected.
345+ If no match is found, the current selected item will remain selected. Matches are case-sensitive.
232346
233347| Input | Type | Description |
234348| ----- | ---- | ----------- |
@@ -241,7 +355,7 @@ If no match is found, the current selected item will remain selected.
241355fcmctrllistbox .InsertItem (self , index , str )
242356```
243357
244- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L322 )
358+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L450 )
245359
246360** [ Fluid] [ PDKPort] **
247361Inserts a string at the specified index.
@@ -260,7 +374,7 @@ If index is >= Count, will insert at the end.
260374fcmctrllistbox .DeleteItem (self , index )
261375```
262376
263- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L367 )
377+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L495 )
264378
265379** [ Fluid] [ PDK Port] **
266380Deletes an item from the list box.
@@ -277,7 +391,7 @@ If the currently selected item is deleted, items will be deselected (ie set to -
277391fcmctrllistbox .HandleSelectionChange (control , last_item , last_item_text , is_deleted )
278392```
279393
280- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L419 )
394+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L553 )
281395
282396** [ Callback Template] **
283397
@@ -294,7 +408,7 @@ fcmctrllistbox.HandleSelectionChange(control, last_item, last_item_text, is_dele
294408fcmctrllistbox .AddHandleSelectionChange (self , callback )
295409```
296410
297- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L440 )
411+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L574 )
298412
299413** [ Fluid] **
300414Adds a handler for SelectionChange events.
@@ -318,7 +432,7 @@ The event will fire in the following cases:
318432fcmctrllistbox .RemoveHandleSelectionChange (self , callback )
319433```
320434
321- [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L445 )
435+ [ View source] ( https://github.com/finale-lua/lua-scripts/tree/master/src/mixin/FCMCtrlListBox.lua#L579 )
322436
323437** [ Fluid] **
324438Removes a handler added with ` AddHandleSelectionChange ` .
0 commit comments