Hello,
New guy here just trying his best.
I have struggled with binding properties between views. I have managed to do it, but there must be a more efficient way of doing this.
I want to change a tag path in a subview by changing a property value in a mainview. This requires that the tag path in the subview is referencing a property from the main view.
First I made a bidirectional memory tag and wrote the value property from a dropdown in the main view to this memory tag. In the subview, I bind this memory tag to a different dropdown (that i visually hide) to convert the memory tag value to a property value within the subview. see the image below.
Pretty dumb but it works.
Can it be done simpler?
- Locate the View you're using in the Embedded View, and select the named View node (not the root node).
- In the Perspective Property Editor, underneath
CUSTOM
, you'll see PARAMS
.
- Add a new View parameter of type
value
.
- Change the key of this new param to be
path
(it could be anything, but since you'll be using it to represent a passed-in tag path, "path" makes sense.
- If desired, you can set a default value for this parameter. I usually just set it to an empty string at this point.
- You also have the option of modifying the data direction (in, out, in/out), but you just need the default "input" mode for this use-case.
- Save your changes.
- In the "main" view, locate your Embedded View.
- Within the props of the Embedded View, locate
params
.
- Click "Add Object Member" then in the resulting popover, hover over "Parameters" and select "path".
- Now, just bind the value of
EmbeddedView.props.params.path
to whatever path you desire.
I realize this looks like a lot of steps, but it's easier than this post makes it look - especially after you've done it previously. Also, this process is a bit more intuitive if you do it while you're building the View to be instanced/embedded.
4 Likes
Now, that is the proper way to do it!
Thank you
1 Like