‎11-04-2009 04:19 PM
Hello,
Is there an easy way to tell LabView to periodically call the event-structure of an XControl? In my scenario the XControl should poll data (for example every 250ms) and update its display. In a normal VI with an event structure I would do this polling in the timeout-case, but this won't work in a XControl.
A complicated way to achieve this automatic refresh would be an additional VI which periodically calls a function of the XControl to force an Update - but I would prefer an XControl which works without such a helper VI.
Best regards.
Solved! Go to Solution.
‎11-05-2009 02:05 AM
‎11-05-2009 02:11 AM - edited ‎11-05-2009 02:12 AM
Deleting an XControl will call the uninit ability.
This XControl has an example of continious updates.
Ton
‎11-05-2009 05:36 AM
Hi tst,
this is exactly the way I've done it. To activate the event-loop, I placed a hidden control on the fassade of the XControl and write signaling to it within the additional "timer-vi". I was just hoping that there was a standard built-in LabView feature to achieve this. Since I consider re-programming built-in stuff bad style, I needed reassurance, that there isn't. Your suggestion and TCPlomp's example suggest that there isn't.
Thanks alot.
‎11-05-2009 01:46 PM
Instead of using a hidden control I would use a User event.
However there are some things to keep in mind:
-Create the user event in the init ability
-Pass the user event to the 'timer.vi'
-Pass the User Event Refnum with the state data
-In the Facade ability you should register when the execution state changes to running and unregister when the state changes to non-running
-Destroy the user event in the UnInit ability
Ton
‎11-05-2009 02:24 PM - edited ‎11-05-2009 02:25 PM
Hi TCPlomp,
I tried UserEvents first but there is a problem: The User-Events are stored in the event-queue but the facade-vi isn't called by LabView when the user event is fired and therefore the user-event isn't processed. The stored user-events are only processed when the facade-vi is called due to another event, for example a valuechange in an element.
In my first approach was only one slight difference to your suggestion: I did the event-registration already in the init ability and passed the whole event-registration in the state data. This event-registration was then wired to the event-structure in the facade ability. I don't know if this would make any difference.
Best regards
‎11-05-2009 03:27 PM
I have seen similar things, and am not sure if this has improved in newer versions of LabVEIW
Ton
‎12-14-2009 04:33 PM