vivante Posted October 15, 2010 Report Share Posted October 15, 2010 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 Quote Link to comment
jgcode Posted October 15, 2010 Report Share Posted October 15, 2010 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 Quote Link to comment
vivante Posted October 15, 2010 Author Report Share Posted October 15, 2010 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 Quote Link to comment
Daklu Posted October 15, 2010 Report Share Posted October 15, 2010 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. Quote Link to comment
vivante Posted October 15, 2010 Author Report Share Posted October 15, 2010 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 Quote Link to comment
Francois Normandin Posted October 15, 2010 Report Share Posted October 15, 2010 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. Quote Link to comment
jgcode Posted October 15, 2010 Report Share Posted October 15, 2010 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. Quote Link to comment
Francois Normandin Posted October 15, 2010 Report Share Posted October 15, 2010 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.