LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI Controls

Hi guys I am working on a main VI that calls a subvi. The problem is that my subvi has a string control which I use as a barcode scanner(etc, I scan a barcode and it will be automatically put into the control). I do not want to put the control in my front panel, I want the control only in my subvi. I want a way to access the value of that subvi which will allow me to scan the barcode and then it will display the value in my main vi. So QWE is my main vi that is calling my subvi TEST-SN.

Download All
0 Kudos
Message 1 of 9
(2,959 Views)

You can wire the indicator in the subVI as an output, then create an indicator coming from that output of the subVI to display on the mainVI while leaving the control within the subVI. Is that what you are looking to accomplish? 

0 Kudos
Message 2 of 9
(2,955 Views)

Does the subVI window stay open after scanning, to be able to accept more scans?  If so, you'll probably want to look at using queues or user events.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 9
(2,929 Views)

I dont want to open the SubVI front panel when scanning. It will just run the subvi in the background which scans in the barcode.

0 Kudos
Message 4 of 9
(2,915 Views)

Barcode scanners are essentially keyboards.  You need to be able to tell them where to type but unfortunately, with a hidden VI running in the background, how do you tell it where to type?  I'm not sure you can set keyfocus on a hidden VI.  What I would do is program the barcode scanner to have a prefix value for every scan (i.e. 'CTRL+g').  And then create a VI keydown? event in your Main.vi that looks for this prefix.  When this prefix is recognized, key focus would be set to an offscreen control so that the barcode value can be typed.  And by adding a value change event on that hidden control, you can execute your code.  You may need to program the scanner with a suffix (Enter or Return) so that the hidden control gets updated after the scan.  

2018-07-30_13-44-18.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 5 of 9
(2,908 Views)

Better yet, set up the barcode scanner to act as a serial device rather than a keyboard wedge.  Use NI-VISA to read the serial port when it receives bytes at the port.  Then programmatically place the acquired data in the indicator you want.

0 Kudos
Message 6 of 9
(2,901 Views)

Could you explain how I would set key focus to an off screen control???

0 Kudos
Message 7 of 9
(2,887 Views)

I would love to set my barcode scanner as a serial read and write. Unfortunately, it does not like it can do that, it had to be done via keyboard. 

If you can know any way i can do that, please let me know, i would be very thrilled as that was my original goal. 

0 Kudos
Message 8 of 9
(2,885 Views)

I'd highly recommend getting rid of that bar code scanner and getting one that will let it be set up as a serial device.  You'll find with keyboard wedge devices that you'll battle the user and the keyboard as to who has control and which control gets highlight.  Just as you are ready for the scanner to put data into your string that you want and was given focus, the user will have clicked elsewhere.  Or the user will be ready to type in their control and the VI will programmatically change the focus to where you want to send the bar code information and the rest of their typing gets put there.

 

But to programmatically set the focus, use the Key Focus property node.

 

Example_VI_BD

0 Kudos
Message 9 of 9
(2,876 Views)