Problem with TreeDblClick
So, I've been trying different ways to do this for like 4 hours now and I just can't seem to find out how to do it.
I'm using ctrlCreate for a menu and I'm trying to make it so when you dblclick something on the tree it will select that data and spawn a script depending on the tvData.
How it works: DoubleClick on the "Add 500m" and it will select that item and spawn a script. It will take the menu item's data (script function name - scr_espAdd500) and then spawn it.
Menu Item to Execute
Code:
_espA500 = _tree tvAdd [[_esp_main], "Add 500m"]; _tree tvSetData [[_espA500], "scr_espAdd500"];
TreeDblClick Event
Code:
_scriptsList ctrlAddEventHandler ["TreeDblClick",{(_this select 0;) spawn spawnScript;}];
spawnScript
Code:
spawnScript = {
_script = _this select 0;
spawn _script;
};
Please help, if you want me to explain it better I will try.