PDA

View Full Version : Variable linking?


Inverness
01-23-2007, 12:44 AM
How do I link a TGraalVar to another so when I change one the other reflects the change?

Cyrioux
01-23-2007, 01:18 AM
If you are talking of TGraalVar as object just use addcontrol and change vars reversibly at the child node with getparent?

Im talking nonsense... these are GUI functions. X_o

Well, script your own function. :>

Skyld
01-23-2007, 01:20 AM
How do I link a TGraalVar to another so when I change one the other reflects the change?
I think b = a.link() might be what you are looking for, but I am not certain how well it works.

Inverness
01-23-2007, 01:28 AM
I think b = a.link() might be what you are looking for, but I am not certain how well it works.
I've tried that about 10 times, and its never once worked so I came here to ask.

Riot
01-23-2007, 03:54 AM
I did testing with .link() awhile back and was rather unsatisfied with the results I got.

this.var = 4;
temp.var = this.var.link();
temp.var++;
echo("temp.var - " @ temp.var @ " this.var - " @ this.var);
Outputs: temp.var - 5 this.var - 4

function onCreated()
{
this.var = 1;
getVar()++; // Works

temp.var = getVar();
temp.var++;
echo("temp.var - " @ temp.var @ " this.var - " @ this.var);
}

function getVar()
{
return this.var.link();
}
Outputs: temp.var - 3 this.var - 2

Inverness
01-23-2007, 05:36 AM
I would really like if this was fixed >_>

Admins
01-23-2007, 03:21 PM
Well for normal variant variables (TGraalVar) the linking is undone once you assign them to some other variable, but it works as function parameter (passing arrays to a function which can modify it). It is not planned to make it work in other ways.