Jump to content
Sign in to follow this  
saetheer

Selected Item's class in Listbox

Recommended Posts

In my ListBox

my script that fills the list looks like this

_cfgVehicles = ( configFile >> "CfgVehicles" );
_filter = _this select 0;
_old_index = -1;


for "_i" from 0 to ( count _cfgVehicles ) -1 do
{
_entry = _cfgVehicles select _i;

if( isClass _entry ) then
{
	_class = configName _entry;
	_scope = getNumber( _entry >> "scope" );

	if( _scope >= 2 && { _class isKindOf _filter } ) then {

			_index = lbAdd [1500, getText(configFile >> "CfgVehicles" >> _class >> "displayName")];
			lbSetData [1500, _index, _class];
	};

};

};

It lists all vehicles with its displayName. Now, then I have selected a row, and press the 'Spawn button. I want to find the selected items classname.

'spawn' button executes spwnBtn.sqf

_LBIndex =  lbSelection 1500;
_LBIndex createVehicle (getmarkerpos "Spawn");

I've also tried numberious ways with lbCurSel, lbSelection etc...

Anyone?

Share this post


Link to post
Share on other sites

Because I felt like this would hijack the old thread, since it was about filling a list using the cfgConfig, and this is about retrieving a class from a selected item.

+ little response in old thread - So in short, sorry.

anyway. hint that displays is 0. Anyone would know why this dont work?

hint "0";
_className = lbSelection 1500;
hint "1";
hint format ["%1",_className];

or...

hint "0";
_className = lbData [listBox, lbCurSel listBox];
hint "1";
hint format ["%1",_className];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×