findchild question
findchild question
Hello,
I am trying to modify an object's expression that is in another container, but I get lost trying...
The goal is to call a pads object inside a container from another pads object from another container.
I tried:
decl preset = firstof(x);
decl a=findchild('Container2', 'Seq');
decl b=findchild(a, 'Load');
setexpression(b, x[preset], 1);
But it doesn't work...
Any help?
I am trying to modify an object's expression that is in another container, but I get lost trying...
The goal is to call a pads object inside a container from another pads object from another container.
I tried:
decl preset = firstof(x);
decl a=findchild('Container2', 'Seq');
decl b=findchild(a, 'Load');
setexpression(b, x[preset], 1);
But it doesn't work...
Any help?
Re: findchild question
Is there a particular reason you choose findchild() and not findobject()?
Re: findchild question
Hello Softcore,
because with findobject I believe I can only find and object that has an unique name...Am I wrong?
And I have several objects with the same name inside different containers.
I am confused...
because with findobject I believe I can only find and object that has an unique name...Am I wrong?
And I have several objects with the same name inside different containers.
I am confused...
Re: findchild question
i.e.
I would love to get something like...
decl preset=firstof(x);
Container2.Seq.Load.x[preset]=1;
I would love to get something like...
decl preset=firstof(x);
Container2.Seq.Load.x[preset]=1;
-
- Regular
- Posts: 315
- Joined: 02 Nov 2013 11:19
Re: findchild question
I don't think setexpression ('someObject', x[number], 1); works. I thought setexpression() needed a quoted string as the second parameter.
So you'd have to build up a vector equal to the sixe of x and then do setexpression('someObject', 'x', newVectorOfValues);
So you'd have to build up a vector equal to the sixe of x and then do setexpression('someObject', 'x', newVectorOfValues);
Re: findchild question
Franky Im also at loss as to what findchild(object, name) means!
As in...does it expect the object AND name (string) of the parent or what? Not sure...if it expects the parent and the name of the child then why couldnt we just go
findobject('child') per se...Im lost
As in...does it expect the object AND name (string) of the parent or what? Not sure...if it expects the parent and the name of the child then why couldnt we just go
findobject('child') per se...Im lost
Re: findchild question
yes and oldgear guy is correct - I missed that....
Its setexpression(object, name-of-expression, val)
So the object msut be a direct reference, the expression must be the string name of the expression
Its setexpression(object, name-of-expression, val)
So the object msut be a direct reference, the expression must be the string name of the expression
Re: findchild question
Thanks for the responses,
yes, the problem is if the expression contains a vector...what can we do then?
yes, the problem is if the expression contains a vector...what can we do then?
-
- Regular
- Posts: 315
- Joined: 02 Nov 2013 11:19
Re: findchild question
AkaMed wrote:Thanks for the responses,
yes, the problem is if the expression contains a vector...what can we do then?
decl i, newVector = {0,0,0,0};
i = findfirst(x);
newVector = x;
setexpression('myObject', 'x', newVector);
You can be more clever using sizeof(x) and fill(newVector...) to create the initial vector, but you should have the general idea now.
Re: findchild question
Works!!!
Thanks oldgearguy!!!
My modified code is:
decl preset = firstof(x);
decl a=findobject('Container2.Seq.Load');
decl newVector = {0,0,0,0,0,0,0,0};
newVector[preset] = x[preset];
setexpression(a, 'x', newVector);
Now I can call any action from anywhere!
Thanks Softcore also!
Thanks oldgearguy!!!
My modified code is:
decl preset = firstof(x);
decl a=findobject('Container2.Seq.Load');
decl newVector = {0,0,0,0,0,0,0,0};
newVector[preset] = x[preset];
setexpression(a, 'x', newVector);
Now I can call any action from anywhere!
Thanks Softcore also!