Find and share HowTos to various installations / configurations!
9 posts • Page 1 of 1
9 posts
• Page 1 of 1
Tykes
Posts:14
Joined: Thu Jul 14, 2016 9:51 pm
Using a Object, and making all the properties visible
Postby Tykes »
I'm very green to OA, and I'm trying to create a panel that allows on mouse click, to make an object i created and saved in it's own panel, become visible without having to type every single element inside the object.
Something like if the panel's name is VFD
Re: Using a Object, and making all the properties visible
Postby RudiKreiner »
It might be easier to use the functions addSymbol() and removeSymbol() instead.
One difference that this approach has though is that any scripting in the symbol (ie reference) that you are adding will only run when it is visible (ie. added)
putting the reference in an diffferent layer and then making that layer visible or invisible should work too, if the above side effects cause a problem.
Re: Using a Object, and making all the properties visible
Postby mkoller »
The object you created in a separate panel is inserted into any other panel as a Panel Reference.
The reference has a name. Simply use this name to address this instance and use
setValue("theName", "visible", false);
In version
Re: Using a Object, and making all the properties visible
Postby EER »
Martin Koller wrote:
The object you created in a separate panel is inserted into any other panel as a Panel Reference.
The reference has a name. Simply use this name to address this instance and use
setValue("theName", "visible", false);
In version
Re: Using a Object, and making all the properties visible
Postby RudiKreiner »
I had always thought that setValue did not work for a whole reference but if Martin says it does, then it was time for me to try it again.
Of course he is right, but what does not work is getValue, which I noticed when I tried to make a function to toggle the visible state, like this:
Re: Using a Object, and making all the properties visible
Postby mkoller »
Absolutely correct.
The following attributes are just write-only and are distributed to all shapes/sub-groups inside:
enabled, visible, foreCol, backCol, color
Re: Using a Object, and making all the properties visible
Postby EER »
Rudi Kreiner wrote:
I had always thought that setValue did not work for a whole reference but if Martin says it does, then it was time for me to try it again.
Of course he is right, but what does not work is getValue, which I noticed when I tried to make a function to toggle the visible state, like this:
where I get this error:
Object does not know the attribute "visible" for "getValue()"
I guess that makes sense because the object can contain several elements whose visible states may not all be the same.
So I fixed up my test by declaring state in the scope lib of the panel and writing the script like this
state = !state;
setValue("theName", "visible", state);
So I have learned that setValue actually does work for whole references (not only for visible attribute but others like backCol too)
but getValue doesn't, for the plausible reason above.
The "getValue" does work when you try to get values from only one "subobject" in a reference panel.
In this example a text-object inside another panel:
string s;
getValue("object.text_a", "text", s);
Of course, you have to know what objects are inside and I think it will make code messy and difficult to understand if used to often.