From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-11-2015 06:37 PM
I’m creating an X Control from two LabVIEW controls and would like to use references to these LabVIEW controls in the X Control’s methods.
My first attempt is to use the X Control’s “Display State” to hold these references. I’ve attached some example code that demonstrates this not working if you run “Test X Listbox.vi”.
I set these two references in the “Data Change” event case in the Facade.vi, but when I try to use these references later in a method, they are not valid.
How can I get these references when I’m using an X Control?
Solved! Go to Solution.
01-12-2015 04:06 AM
If you're changing the Display State cluster in a event case like you are doing for the Data Change case, you need to set the "State Changed?" boolean from the Action cluster to True so that LV applies the changes 🙂
Here is good template to apply when you need to store a control reference in a XControl state. This piece of code must be inserted before entering the Façade loop. Also, Data Change is not the best case for this kind of code, better would be Display State Change 🙂
Regards,
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
01-12-2015 09:26 AM
Thank you, that worked perfectly!
Two questions:
01-12-2015 09:32 AM
In place avoids making data copies during the execution - http://www.ni.com/white-paper/6211/en/
And because the façade VI does not execute continuously, you don't really know which events will be fired according to your interactions with the XControl. Adding the code before the while loop or inside the timeout case (which I don't prefer because this case is not meant for this) is the best way to make sure it's executed every time Façade executes.
Hope this helps 🙂
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
01-12-2015 10:35 AM
All that made perfect sense. Thanks!