SolvedProblem with TreeDblClick

Posts 1–5 of 5 · Page 1 of 1
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.
Quote Originally Posted by SkruffysDB View Post
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.
Might i suggest you use Jme Lite for reference. Its using listbox instead of treeview, but if im not mistaken, they work in much the same way.
Quote Originally Posted by Jme View Post
Might i suggest you use Jme Lite for reference. Its using listbox instead of treeview, but if im not mistaken, they work in much the same way.
I've tried messing around with it but I would like to use mine overall. Can I private message you this and maybe you could help me with it?
Quote Originally Posted by SkruffysDB View Post
I've tried messing around with it but I would like to use mine overall. Can I private message you this and maybe you could help me with it?
im not saying use mine, im saying use mine as a reference, so you can see how it works
No response after two days, assuming solved.
/Closed
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us