LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a control be part of a cluster without being in the cluster?

I'm starting to use the Object Oriented features in Labview Programming. A benefit of OOP is that I can group data within the program in ways that make that improves the code I write. Before, I used to do this by grouping controls in clusters on the front panel. But what makes sense for the program doesn't usually make the best sense for the user interface. So if I want to get data from the front panel into my Class data clusters, I have to write a lot of code that uses set/get methods.
 
It would be nice to have virtual clusters on the front panel, so that I could cluster data, then have a method to take in the virtual cluster and set all the Class's data. I've thought of just making the borders and foreground of my clusters transparent, then making all clusters cover the front panel. I haven't tried this because I have a tab control on my front panel, and a cluster would have to be on a single tab while my controls are on multiple tabs.
 
Any suggestions on how to transition from front panel to program?
David Grucza, CLD
0 Kudos
Message 1 of 6
(3,188 Views)
it might be a hassle, but you could set up Value Change events for all your controls, and update the class cluster each time a control value changes.
Message 2 of 6
(3,174 Views)

I don't think that avoids the massive number of set methods though. I do want to change this over to an event driven application, so there might not be a way around this. I was hoping to update all Class parameters when the main part of the program executes with set-all methods that use the logical(virtual) clusters.

I don't think National has given this any thought yet because without OOP it wouldn't have been obvious (at least to me) that it was needed. Though I could see the usefulness of providing  a way to disassociate front panel grouping from program grouping of controls, even if not using classes to define new data types for use in the code. But Labview has so many features that I don't know about, that I am hopeful that somene knows of a way to do this. .

David

David Grucza, CLD
0 Kudos
Message 3 of 6
(3,165 Views)

If I understand correctly, you want to link controls with the class data. This is a bit anti-OOP (OOP is also about information hiding, so you're no supposed to know what's going on inside the class), but here's a possibility - You can add a VI to the class which will register the relevant controls (example) and handle what you want using dynamic event registration. This will allow you to have separate controls and connect them.


___________________
Try to take over the world!
Message 4 of 6
(3,155 Views)

Thanks, but I don't intend to violate the rules of OOP. I would still have an accessor method (VI) called configAllParams that would take the virtual cluster as an input. I have to give some thought into how I could preserve the Public Interface with something like this.

I'm not sure I understand what you are suggesting, but I'll look at that in a few days. It sounds like passing a reference to the calling VI into a sub-VI to access control values. I don't understand how this works in enough detail so that I know I won't be breaking code if I update control names in the calling VI.

Thanks, David

David Grucza, CLD
0 Kudos
Message 5 of 6
(3,139 Views)


David at Lockheed wrote:

It sounds like passing a reference to the calling VI into a sub-VI to access control values.


I'm not talking about passing the reference of the VI, but the references of the controls. This will protect against name changes, etc.

___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(3,127 Views)