QControl Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

My first QControl. Comments/criticism please!

Hi all,

 

I heard of QControls recently and have, I think, a clear use case that I have tried them out on. I have attached a self contained project that illustrates my example. I would deeply appreciate some comments/criticism to see if I have understood the ideas in QControls well enough or if there is something that I am missing/doing terribly wrong!

 

The use case is for a set of controls that manage the launching of an application. I use classes to manage hardware in the loop testing and a Launcher.vi to configure the application at runtime, telling the application what instruments to simulate and what to connect to directly. The wrinkle here is that the control that handles the address varies depending on the type of instrument, so I couldn't just create one cluster to represent all the types.

 

QControls make sense here because the majority of the behaviour of this set of controls is inheritable. Launcher Cluster handles nearly all the UI behaviour, which is really neat and extensible.

 

The Class Selector is populated by Initialize Control.vi. Changing Class Selector manually casts the class to the appropriate sibling and calls Refresh Addresses.vi, which updates the Addresses control. Test Connection then calls a class-specific method for testing whether the hardware is connectable. Once the user is happy with their selections they launch the application using the Launch button.

 

Confusingly, I have an array of Instruments in the properties of Launcher Cluster, which is used to populate the Class Selector ring, AND a single Instrument in the State Data, which is represents the currently selected instrument.

 

I am using QControl to represent a set of four controls, but I only do the inherit chain for the ring control referring to the Class Selector control. This seems weird. I could do it for whole set of four, but I don't really understand the pros and cons of this!

 

I am exposing the private State Data so that the children of Launcher Cluster can manipulate the Instrument as necessary. This seems weird. It seems appropriate that Instrument should be held in State Data, since I want it to persist for the lifetime of Launcher.vi and be available should I want to call class specific methods in any child of Launcher Cluster.

CLA - Kudos is how we show our appreciation for comments that helped us!
0 Kudos
Message 1 of 1
(1,004 Views)