Jump to content
Sign in to follow this  
kagenekosama

ctrlEventHandlers Not working for my dialog

Recommended Posts

Hey all, so i'm trying to add an event handler to a custom dialog i created, however the ctrlAddEventHandler seems to fail and the event handler is not being added, or it just doesn't work.
I'm trying to change Text once i change the current selection in a combo box, but it doesn't work.

_myDisplay = findDisplay 7200;
_comboCtrl = _myDisplay displayCtrl 2102;

_myCtrlEH = _comboCtrl ctrlAddEventHandler ["onLBSelChanged",{ctrlSetText [1019, "Text"]; hint "Executed";}];

_myCtrlEH returns a -1 value. 
 

Share this post


Link to post
Share on other sites

Uhh. What are you trying to do exactly? Use lb commands to populate it. Also, remove on so just:

"LBSelChanged"

Example from my project:

(_display displayCtrl IDC_SPAWN_SELECTION_SPAWNS) ctrlAddEventHandler ["LBSelChanged",
{
	_display = uiNamespace getVariable "disp_spawnSelection";
	_map = _display displayCtrl IDC_SPAWN_SELECTION_MAP;
	_spawn = lbText [IDC_SPAWN_SELECTION_SPAWNS, (lbCurSel IDC_SPAWN_SELECTION_SPAWNS)];
	_town = lbData [IDC_SPAWN_SELECTION_SPAWNS, (lbCurSel IDC_SPAWN_SELECTION_SPAWNS)];
	ctrlMapAnimClear _map;
	if (lbCurSel IDC_SPAWN_SELECTION_SPAWNS isEqualTo 0) then
	{
		_map ctrlMapAnimAdd [1, 0.18, getMarkerPos (selectRandom townMarkers)];
	} else
	{
		_map ctrlMapAnimAdd [1, 0.18, getMarkerPos _town];
	};
	ctrlMapAnimCommit _map;
	_getTownStatus = [_town, _spawn] call client_fnc_getTownStatus;
	if (lbCurSel IDC_SPAWN_SELECTION_SPAWNS isEqualTo 0) exitWith
	{
		(_display displayCtrl IDC_SPAWN_SELECTION_SPAWN_STATUS) ctrlSetText localize "STR_spawnSelection_randomTownDescription";
	};
	(_display displayCtrl IDC_SPAWN_SELECTION_SPAWN_STATUS) ctrlSetText _getTownStatus;
	if (_getTownStatus isEqualTo (localize "STR_spawnSelection_status_blocked")) then
	{
		(_display displayCtrl IDC_SPAWN_SELECTION_SPAWN) ctrlEnable false;
	} else
	{
		(_display displayCtrl IDC_SPAWN_SELECTION_SPAWN) ctrlEnable true;
	};
}];

Too lazy to snip it down.

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  

×