Jump to content

reference to private data


Recommended Posts

Hallo JG,

thank you for your reply.

I've read on Labview context help that Cildren[] property is not available at runt time, my idea is to work on private data using a reference to private data cluster from a member of the class at run-time. I need to compare every single cluster item label with a list of tags and get/set a specific set of values programmatically. My application will use this method to filter some data according to user's selection and he knows only names of cluster's items.

thanks,

Vivante

Link to comment

I need to compare every single cluster item label with a list of tags and get/set a specific set of values programmatically. My application will use this method to filter some data according to user's selection and he knows only names of cluster's items.

I think it's probably not a good idea for your application to rely on labels if there's another way to accomplish the same thing. Instead of putting each value in a unique control in a cluster, can you use a look-up table? Create a 1d array of strings to hold the names of the data. Create a second 1d array of strings (or ints, variants, etc.) to hold the data value.

post-7603-038578900 1287145082_thumb.png

Link to comment

Well, Daklu you have understood my idea: I want to use control's labels as keys in my lookup table so I can change private data definition of my class according to my needs (to be correct I must write "to my customer caprice") and I don't have to update manually the array constant you have shown in your example. Sometimes I use this technique to update those panel's controls with same name of my cluster fields (in this case my structure is a simple cluster not a class definition, of course).

Vivante

Link to comment

I've read on Labview context help that Cildren[] property is not available at runt time, my idea is to work on private data using a reference to private data cluster from a member of the class at run-time.

You will not be able to work on your Private Data at runtime. Creation / Removal of controls and indicators can only be done in the IDE and when the VI is Idle.

If you want to get a reference at runtime, your best chance is with the Open VI reference and wiring "classname.lvclass:privatecontrolname.ctl". AQ mentioned that simple trick is a thread I have not taken time to find again.

But the result is the same, you can't modify data at runtime. I haven't tried if you can even read it at runtime. I'd be really surprised if you could, because there's no reason to be able to get a reference one way and not the other. It's the same reference after all. Let us know if you succeed at runtime.

Well, Daklu you have understood my idea: I want to use control's labels as keys in my lookup table so I can change private data definition of my class according to my needs (to be correct I must write "to my customer caprice") and I don't have to update manually the array constant you have shown in your example. Sometimes I use this technique to update those panel's controls with same name of my cluster fields (in this case my structure is a simple cluster not a class definition, of course).

Vivante

Probably you need to create a private method in your class to support this, instead of going to the Private Class Data directly.

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
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.