キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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
4,231件の閲覧回数
解決策
トピック作成者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
4,229件の閲覧回数

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
4,202件の閲覧回数
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
4,189件の閲覧回数

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
4,174件の閲覧回数

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
4,162件の閲覧回数