LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse activity blocks call by reference

Hello,
 
It seems that any mouse activity at all blocks a call by reference, causing it to freeze until the mouse activity is done (LV 7.1.1, Windows XP).
 
These threads here, here, and here all describe a similar problem, but either not the same problem or without a full resolution.
 
Try this:  Unzip the attached zip file and run "Main.vi".  Note that the "Numeric" indicator increments.  Now try to do anything with the mouse on the other controls:
  • Click the ring but wait a bit before selecting a new value
  • Click and hold either scroll bar on the table
  • Right click on any control
  • Click and hold a front panel scroll bar

When I do any of these things, the loop stops until I'm done.  Note also that it doesn't matter if "Wait until done" is True or False.

The VI being called by reference ("ByRef.vi") is simply writing a random number to an indicator, but I see the exact same behaviour if it's a totally empty VI.  I've tried changing the priority, preferred execution system, and reentrancy of this VI, with no luck.

It seems that the "Run" method is running in the UI thread - is this true?  If so, why?

Does anyone have a definitive solution to this problem?  We need to run a "plugin" by calling by reference, but if we set it up like this any extended mouse activity does very bad things.

Jaegen

0 Kudos
Message 1 of 4
(3,134 Views)
You can fix this by replacing the "invoke node" with "call by reference". The only downside to this method is that the VI type specifier must be defined, so it must be the same for all VIs called. I've attached a "fixed" version.
 
Click, Clack, Moo is a classic!
 
Alan Gleichman
 
 
 
 
Message 2 of 4
(3,125 Views)

Thanks!

Fortunately that will work for us.  But why does it work???  Can someone enlighten me?

Jaegen

P.S.  And yes, "Click, Clack, Moo" is a classic.

Message 3 of 4
(3,111 Views)
Hi Jaegen,
 
The Run method in the VI Server Invoke Node is functionally different than the Call by Reference node. The Call by Reference Node runs a VI as if it were a sub VI of the VI which contains the Call by Reference Node. The Run method of the Invoke Node runs the VI as if it was run as a top level VI. That is, calling the run method of the Invoke Node is equivalent to pressing the run button on the front panel of a particular VI. The reason the behavior is different results from the way top level VIs are run in LabVIEW. Each time a top level VI is run, a call is posted to the User Interface thread, where the VI first runs.
 
Thus, invoke nodes (and property nodes for that matter) run in the user interface thread (as you mentioned above). While there is front panel activity, the UI thread is not available to execute the VI with the Run method until the front panel activity completes. Any modal windows, drop down boxes, scroll bars, etc will essentially lock the UI thread preventing invovke and property nodes from executing.
 
Hope this helps,
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
Message 4 of 4
(3,070 Views)