取消
显示结果 
搜索替代 
您的意思是: 

Automatic switching between two string inputs

已解决!
转到解答

Hi guys, I have several string inputs on the front panel, which each should take an input from a barcode scanner.

 

What I want to do the VI to achieve is, jump to the next available string input, once one of the string input receives an input from the barcode scanner. (as shown in the transition from picture 1 to pic 2.)

 

Is this possible?

 

Cheers!

 

 

Picture 1

 

1.JPG

 

 

Picture 2

2.JPG

0 项奖励
1 条消息(共 6 条)
3,908 次查看
解答
已被主题作者 jack@nz 接受
You can use an event structure with a value change event. When the value of the control changes, meaning you scanned something, you can set focus to the next control you want to input your scan data.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
2 条消息(共 6 条)
3,906 次查看

One thing to watch out for is to check to see if the scanner appends a linefeed or other similar character to the string - you will likely need to strip this out.

 

Also, if the scanner is connected via a keyboard wedge, then as far as the LabVIEW VI is concerned, the characters would be coming in as if they were being typed in via the keyboard. That means that in order to see a value change event you will need to set the properties of the string control to "update value while typing". You can do this by right-clicking on the string control. This means that the event will be triggered for each character typed. Thus, you will need to determine when you've got the full code. Obviously, you will need to handle incomplete scans. 

 

If, on the other hand, the scanner is connected via a serial port, then you would know that you've received the full code once you see the termination character on the serial port. 

3 条消息(共 6 条)
3,879 次查看
When ever I've used a barcode scanner I would set up the scanner to append a tab at the end of the scan.  This way it will go to the next control as if the operator pressed tab.  I would say look into the configuration of the scanner and see if you have that option.
4 条消息(共 6 条)
3,866 次查看

Thanks guys for your feed back !

 

to Smercurio: thanks, this is useful as my barcode scanner plugs into a serial port 

 

to Hooovahh: what a shame I saw your post after I have implemented my VI using Mark's feed back, doing it your way would certainly have made it easier than what I have done.

 

 

Although the VI is working now, there is still one thing I am curioused about:

 

I have set the VI to set focus on the first string input when it starts. Now, this would work only if I run the VI from the front panel.

 

If I run  from the block diagram, the VI doesnt set focus on the first string input.

 

This is only for my curiousity, but does any one know why this is so?

 

Cheers! 高兴表情

0 项奖励
5 条消息(共 6 条)
3,851 次查看

jack@nz wrote:

 

I have set the VI to set focus on the first string input when it starts. Now, this would work only if I run the VI from the front panel.

 

If I run  from the block diagram, the VI doesnt set focus on the first string input.

 

This is only for my curiousity, but does any one know why this is so?

 

Cheers! 高兴表情


I just verified that.  Running by clicking the run arrow on the block diagram makes the block diagram window come to the foreground.  Therefore, the focus means nothing because it is done on a window that is in the background.  If you click on the front panel and bring it to the foreground, the focus is NOT on the first string.  I would guess that the front panel string focus property was overwritten when the block diagram became in focus.  So the string focus is lost.

Lesson:  Use the run arrow on the front panel to run VIs involving setting focus on some front panel object.

 

- tbob

Inventor of the WORM Global
0 项奖励
6 条消息(共 6 条)
3,839 次查看