LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI Event Issue

Hello, I'm just familiarizing myself with the programming concepts in
LabVIEW and I've run into a somewhat irritating issue with event
handling, probably due to my relative inexperience with events as
interrupts. I currently use LabVIEW 7.0 but will soon be upgrading to
the newer NI Suite.
<block o' words>

In a test program I've been fiddling around with mouse and keyboard
input and for the most part, it's gone smoothly, especially with the
mouse input. However, the problem arises when I attempt to write the
character array generated by the acquire data function for the
keyboard to a string. As a workaround to the difficulty in using that
specific subVI, I've opted to create my own subVI that uses events to
acquire user input and output the results to a string indicator. The
VI I've developed creates, registers, generates, and unregisters for
events and works smoothly on its own, provided I include a while loop
so that multiple characters can be read (I use the key down event).

When I call this VI from my general mouse and keyboard i/o VI I run
into the problem that the mouse input locks up while the while loop is
running to acquire keyboard input. What's worse, the program only
registers keyboard input when the subVI Front Panel is open, only
sending it back when I stop the while loop manually, which is
admittedly a bit of a pain. If I remove the while loop, calling the
subVI for each iteration of the general application, no characters are
read at all, I assume either because the timeout occurs very quickly
or because I need the subVI front panel open to generate the event.

</block o' words>

How can I get the subVI to register a keyboard event that occurs in
its parent VI? Do I need to generate the event externally and send it
in to the subVI? Any help would be greatly appreciated,

Eccomi

0 Kudos
Message 1 of 4
(3,136 Views)

Can you attache the VIs you are working with so that we can help you debug\explain the behavior better?

0 Kudos
Message 2 of 4
(3,127 Views)
In this post at openg.org I posted a set of VIs that registers for a value change of a specific control.

I think you have to do the same for a keydown, you have to register this for the front most VI (not the VI with the code in it). Also it might help to set the state of the frontpanel of the subvi to hidden (that's a VI.frontpanel.state property).

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 4
(3,116 Views)
To register top-level events in a subVI, pass a reference to the top-level VI to the subVI. In the subVI wire this reference to a register for events node. Right click on the node and select the event you want to register. (see attached picture)

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 4 of 4
(3,100 Views)