Jump to content

Dynamic Control of Properties


Recommended Posts

Hello All,

I am using LabView 8.2 and am using the method control val. get and set a lot. This works great for getting and setting values of controls and indicators in other vi's. I was wondering if anyone knew a similar way to get and set properties of a control or indicator. Specifically I am wanting to trigger and event case in another vi (value signaling) as well as setting the string values in a ring control.

Any help would be appreciated.

Thanks.

Link to comment

QUOTE(Aaron @ Sep 11 2007, 03:25 PM)

Hello All,

I am using LabView 8.2 and am using the method control val. get and set a lot. This works great for getting and setting values of controls and indicators in other vi's. I was wondering if anyone knew a similar way to get and set properties of a control or indicator. Specifically I am wanting to trigger and event case in another vi (value signaling) as well as setting the string values in a ring control.

Any help would be appreciated.

Thanks.

Hi Aaron,

Could you elaborate on what you have tried and exactly what you want. It just sounds like you have answered your own question.

Ben

Edit:

After reading raglefrocks follow-up posting, Ben slaps his frohead and utters "Doh".

Link to comment

QUOTE(Aaron @ Sep 11 2007, 02:25 PM)

Hello All,

I am using LabView 8.2 and am using the method control val. get and set a lot. This works great for getting and setting values of controls and indicators in other vi's. I was wondering if anyone knew a similar way to get and set properties of a control or indicator. Specifically I am wanting to trigger and event case in another vi (value signaling) as well as setting the string values in a ring control.

Any help would be appreciated.

Thanks.

If you have a reference to the other VI that's running, you can wire that VI reference into a property node to get a reference to the Panel. Then wire the Panel reference into another property node and get a reference to all the controls (Controls[ ]) on the panel. You might have to loop through those controls looking for the right label, and then cast it from a generic control reference into the desired type (ring, slider, etc.).

Link to comment

QUOTE(Ben @ Sep 11 2007, 02:40 PM)

Hi Aaron,

Could you elaborate on what you have tried and exactly what you want. It just sounds like you have answered your own question.

Ben

Sure,

Lets say I have a ring control in one vi and I want to change the text in that ring or enum control from another. When I use the set or get control method, I would only get or set the index as that control is a number. I would like to update the text it displays which is a property of the control. Another example is if I have a boolean control in one vi I can get and set its value from another but that will not trigger an event case. I would have to use the property value signal. I need to know if there is a want to set the properties of a control instead of setting its value from another vi.

Aaron

Link to comment

QUOTE(Aaron @ Sep 11 2007, 03:54 PM)

Sure,

Lets say I have a ring control in one vi and I want to change the text in that ring or enum control from another. When I use the set or get control method, I would only get or set the index as that control is a number. I would like to update the text it displays which is a property of the control. Another example is if I have a boolean control in one vi I can get and set its value from another but that will not trigger an event case. I would have to use the property value signal. I need to know if there is a want to set the properties of a control instead of setting its value from another vi.

Aaron

The ring is easy, just use the "Strings" property to write a new array of strings.

The enum is another story. the strings associated with an enum are imbedded in the data type so they can not be changed at run time.

I am recovering from my first reply?

Ben

Link to comment

QUOTE(Ben @ Sep 11 2007, 12:59 PM)

The ring is easy, just use the "Strings" property to write a new array of strings.

The enum is another story. the strings associated with an enum are imbedded in the data type so they can not be changed at run time.

I am recovering from my first reply?

Ben

I think the issue is using the VI Method to set control values by name, versus using the control properties to change value or other properties.

To do what you want to do, you need to access the control by reference. You can pass the reference around, or you can get the control references from the VI in question (VI >> Panel >> All Controls) and search for it by name. If you are already using the VI ref only, this would be the easiest transition. Just be aware that if you have any nested controls (clusters, tabs, etc.) you will need to recursively search through these.

Link to comment
QUOTE(Ben @ Sep 11 2007, 02:59 PM)
Ok, Maybe this would be better. I am attaching 2 vi's. From vi1 I would like to get and set the string values in vi2's ring.AaronQUOTE(Aaron @ Sep 11 2007, 03:19 PM)

Ok, Maybe this would be better. I am attaching 2 vi's. From vi1 I would like to get and set the string values in vi2's ring.Aaron

Update, By using the front panel and controls reference I can do value signaling to the other vi. But it does not seem I have access to all properties just some default properties. For example I do not see the strings[] property for this control using this method.Aaron

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.