Jump to content

reference to private data


Recommended Posts

Posted

Hallo guys,

I have try to create a class member where I explore my private data by reference, but I cannot create the reference. Is it possible? can I link the private data cluster in other ways?

thank you in advance,

Vivante

Posted

Hi vivante

A smart man once told me....

You can get a reference Class Control by wiring out is the first index of the Children [] property.

I recommend checking out Francois Normandin's LVClass API too.

Cheers

-JG

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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.

Here you go.

Posted

Simple answer. The Class Private Data is stripped from its Front Panel in the build process (no way to change this that I know), so we can't get a reference to the specific values on the FP... no FP ref => no data cluster ref => no controls references.

Here you go.

Thanks buddy

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.