When using lbSelection inside a onLBSelChanged event, lbSelection will provide the previous selection. ie it is not updated in time to provide the correct information.
Description
Description
Details
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Category
- Scripting
Steps To Reproduce
Description.ext
#include "\a3\3den\UI\resincl.inc" import RscListBox; //import RscListBoxMulti; class testLB { idd = 10000; class controls { class myLB : RscListBox { idc = 100; x = 0; y = 0; w = 1; h = 1; style = LB_TEXTURES + LB_MULTI; class items { class item0 { text = "0"; }; class item1 { text = "1"; }; class item2 { text = "2"; }; }; onLBSelChanged = " \ params[ '_ctrl', '_index' ]; \ hint format[ 'index: %1, item: %2', _index, _ctrl lbText _index ]; \ systemChat format[ 'Selection: %1', lbSelection _ctrl ]; \ "; }; }; };
initPlayerLocal.sqf
waitUntil{ time > 2 }; _display = findDisplay 46 createDisplay "testLB";
Run mission, wait for UI to display, make a selection (either single or multi), notice systemChat of lbSelection provides info related to the previous selection ie on first selection a blank array, on next selection provides array of previous selection.
Additional Information