LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

associating control/indicator with class instance

I have a parent class that handles a byte array for serial transmission. Each child of this parent class then handles a different variant of data, (waveform, boolean, etc.) and is associated with an control or indicator. For example, a boolean control when switched will create a byte array and transmit over serial, while a waveform graph indicator is polled in a while loop which transmits a request to update itself with data.

 

It is easy enough to run 1 instance of each class, (just wire the input/output of the class data to a control/indicator) My question now is, what is the best method of scaling this up while maintaining readability? One option i tried was creating an array of instances, but i then have to have a way of associating a GUI object with a class instance. I did this by including a reference to a GUI object as parameter for the class Init, but this doesn't sit right with me. Is there a better way of associating a control/indicator with a LVOOP class instance?

 

Thanks,

Marc

0 Kudos
Message 1 of 2
(1,854 Views)

To use a more generic method you could include a name or label to your class initialization. Then create a lookup table that associates the object name with the desired control/indicator.

 

A more complex solution would be to define a generic messaging class/architecture. Your classes could then post messages and return unformatted information specific to that class. The receiver of the message would understand that raw format and could then process it as required. This type of an approach is nice because your working classes remain the same. The always generate some wet of messages for that class. Your UI can then change very easily simply by changing the code that services the messages. This decouples your processing from your UI which makes for a flexible design.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 2
(1,846 Views)