LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XControls vs LVOOP

I've been working on learning LVOOP for a bit now.  Today, I decided to start playing with XControls.  I'm not sure I really see a large functional difference?  Both are a special data type, carried around in a type def cluster, with a group of VIs to control the data privately. What am I missing here?

0 Kudos
Message 1 of 6
(2,919 Views)

You miss:

XControls are in run mode already when you place them on the FP of a VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,902 Views)

I was actually wondering about that.  The example shows an event structure with "always wire 0 timeout in to the event".  How often is that ... basically sub VI called.  It isn't just sitting there hogging CPU cycles is it?  If not, when does LV pick to execute that code.

0 Kudos
Message 3 of 6
(2,897 Views)

Hi Bowen,

 

you really should read the LabVIEW help on XControls…

 

LabVIEW will execute the code in the other events - just check their names.

LabVIEW also comes with an example XControl project - with a lot of comments in it.

 

XControls are meant to replace "standard" controls/indicators. You can embed "behaviour"/functionality in those controls beyond what is possible with standard controls.

The basic XControl example creates a temperature indicator where you can switch from °C to °F and vice versa. This switching already works when you embed that XControl on your FP - without running the containing VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,894 Views)

LVOOP and XControls are completely different kinds of things.

 

The point of an XControl is that it is a VI for implementing a front panel object that LV maintains as reserved for execution in the background. There are dedicated VIs that execute under predefined conditions. For example, there is an init VI that runs when the XControl is loaded into memory. Once in memory, the XControl normally it does nothing until one of the events in the Facade VI gets fired - then the code for that event runs and execution ends with the timeout which puts the facade back into the position of waiting for something else to happen.

 

I did a presentation on XControls at NI Week in 2012 and that paper might be online somewhere. If not, PM me and I'll send you a copy.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 5 of 6
(2,889 Views)

Gerd,

 

I have been through most of the help on them.  I realize that what they are "meant" to do is replace controls.  But lets look at what they actually do:

 

They have public accessable data that is the control itself.  This can be any data type.

 

They then have private data that is the "State Type Def" that again can be any data type. Usually a cluster containing the "properties" you want to set.  You set and control this data with calls (done through a reference instead of a VI) that is done through supporting VIs.  That is pretty close to the definition of OOP  😛

 

About the only difference I can see at all is inheritance. XControls inherit the methods/properties of the Object class in LV, but you can't set anything beyond that.  That having been said, in LVOOP I haven't really used that much inheritance anyway...

 

0 Kudos
Message 6 of 6
(2,880 Views)