[Feature-11617] "Copy Path" not available for all view components

  1. The behavior you unexpectedly encountered: In the project browser I am not seening the “copy path” option that I would expect on the components.
  2. The behavior you were expecting to see: the “copy path” option for all components in an view
  3. A list of the steps you took that exposed the issue: Attempted to find the copy path on other components in a view.
    Is this due to the nature of Perspective or due to the function not yet being added?
  4. A list of helpful information about the situation you were in, such as:
    Ignition is the nightly build as of 08:00 MST 11-12-2018
    Browser is the current Chrome
    Java is 1.8.0_191


1 Like

Using the Vision Module, this has been a great help to make sure the path is correct/not mis-typed. Same for perspective?

Currently, there is no way to copy a Component’s path. In your example, the Log_on View is a Project Resource, which is why it has a path. Project Resource paths are helpful when Embedding Views, or providing the path to an Image.

Component Paths are something which could be copied if enough users request that feature, but due to several features in Perspective I believe the intention was to encourage users to move away from using hard-coded paths. Consider the Following example:

I want to bind my Label to a value located at MyView.root.CoordinateContainer.CoordinateContainer.CoordinateContainer.TextField.props.text
Two weeks form now I’m going to add a new Flex Container to the page, and I’ll then have to redo any bindings which have had their path affected.

Using the new Messaging Bus, you don’t need the path anymore.

Repl.json (3.5 KB)

Use this View by importing with the following steps:

  1. Make a new View somewhere.
  2. Copy the .json file contents (Ctrl-A/Cmd-A in your chosen text editor).
  3. Hold Shift and then right-click the View node (not root, but the actual named View Node, like Log_on).
  4. Select “Paste JSON”.

Now you can get an idea of how the messaging system works. If you change the text in the Text Field, the Label stays Synched.

  1. You’ll want to right-click the TextField.props.text property and select “Edit Change Script…” (this will show the code to broadcast a message on the messaging bus).
  2. You’ll want to also right-click the Label Component and select “Configure Scripts” (this will show how to listen for broadcast messages and how to access their data).
  3. Please keep in mind that I was overly verbose to clarify what was happening during the scripts - everything I did in there outside of the logging could be done in one line if desired.

Notice how I never once set any kind of path to any component? Using the messaging bus in this manner will prevent needing to worry about paths of components (although you still need to be careful with the passed data object).

5 Likes

Thanks for that example, those will be very helpful with this new way of doing things in Perspective. I was also wondering, is it planned to have more indicators on what has scripts configured? I like how bindings in the property editor are shown, with a highlighted section on the left all the way down to the bound object, something similar for scripts would be great too.

1 Like

Another reason for not having path copying which I forgot to mention is that you are unable to bind to components outside your current View.

MyPageA.root.Label.props.text may absolutely NOT be bound against the value in MyOtherPageB.root.TextField.props.text.

When you have an active Session, the only properties which exist at any given moment are those on currently open Views (if you have multiple tabs open), Session properties, and Tag values.

1 Like

@mrogers, we’re constantly tweaking the UI, and yes, we have plans to provide indicators for when Components have scripts attached. If you look at the provided View and drill down to the Text Field, you’ll notice that props.text does indeed have an icon to denote that there is a change script attached to that property. We will be doing something similar to components in the Project browser to provide visibility into attached scripts and the like.

1 Like

My apologies, I am having a little trouble getting your .json to import, did I miss where we already discussed how to import them to perspective? Can you provide the link?

Import was a bit of a misnomer - I’ll update my post.

  1. Make a new View somewhere.
  2. Copy the .json file contents (Ctrl-A/Cmd-A in your chosen text editor).
  3. Hold Shift and then right-click the View node (not root, but the actual named View Node, like Log_on).
  4. Select “Paste JSON”.

Thanks, that worked, I’ll review as you recommened

1 Like

I agree with Cody, I think a “copy path” would encourage bad behavior. Instead, anywhere you might actually want to use a component from another component, there should already be browser helpers, which create the paths for you, and use relative reference syntax (e.g. ..\my-sibling), so the paths are shorter and more resilient to name changes.

I would really like this feature. Currently when I’m documenting changes I have to do a “Copy Path” on the view and then manually append the path to the component in my documentation. Having a "Copy “path” on a component where I can get the full path of the component would be very helpful.