Page MenuHomeFeedback Tracker

lbSelection is not updated in time when used inside onLBSelChanged
Feedback, NormalPublic

Description

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.

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

Event Timeline

Larrow created this task.Aug 22 2022, 3:27 AM

Should be fixed in rev.149836

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Aug 28 2022, 1:49 PM
BIS_fnc_KK changed the task status from New to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.