Past NIWeek Sessions

cancel
Showing results for 
Search instead for 
Did you mean: 

XControls in Theory and Practice

Obtain useful and practical guidance on how to effectively develop XControls. LabVIEW Champion Michael Porter presents both the theory of operation and practical best practices for XControl development and troubleshooting in LabVIEW.

Michael Porter, Lime Instruments Inc

Comments
battler.
Active Participant
Active Participant
on

A bit brief..

Didn't understand the insertion and extract parts. Is he saying to use variant to pass data in at State which means you don't need to change datatype for different methods and properties?? Any further examples?

I'm making extensive use of xcontrols and want to make sure I'm doing the right things..

mikeporter
Proven Zealot Proven Zealot
Proven Zealot
on

The point is that the datatype for the state data should be an array of variants. This structure allows you to add and delete state values without needing to worry about "versioning". If fact you can write VIs that at startup check the data structure that was read when the XControl loaded into memory and automatically verify that each value datatype is correct, add new values and delete obsolete ones.

In terms of the inserting and extracting, I created two polymorphic VIs with separate instance VIs for each value in the array. Those instance VIs handle the conversion to and from the variant form. In addition, a very useful side effect of how this is done is that the data in the effectively type-checked. Consequently, you can't put the wrong kind of data in the array. Also the indexing into the array is handled by a typedef enumerated type that is a list of every value in the array. This is so you don't have to worry about what element each value is.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Contributors