LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Click on control with KeyFocus

Hi!

 

I have a problem with a VI of mine.

The front panel consists of one string control and one button.

As you can see in the picture (block diagram) I initialize my controls and then i go into a loop and waits for some input to the barcode string control.

 

The barcode string control has the following properties:

* Normal display

* Limit to single line

* Update value while typing

 

The other cases in the event structure are:

* The timeout event, which only changes the name of the button.

* The value change, connected to the button

 

Why does this VI become unresponsive if I start it and then click somewhere on the front panel of it, without having typed anything in the string control or done anything else!

 

Best regards Peter

 

0 Kudos
Message 1 of 10
(3,540 Views)

Dataflow, man!

 

Nuke those sequence structures and enforce dataflow using the error lines.  All the propnodes have err in/out for that reason. 

 

I'm betting the code's trying to execute something in the timeout case of the event structure because an event happened.

 

Post the VI instead of a screenshot and that'll make troubleshooting a lot easier.

0 Kudos
Message 2 of 10
(3,534 Views)

While loop does not stop until barcode is not equal to empty string.

Your event structure does not run until after you type something into barcode

Omar
0 Kudos
Message 3 of 10
(3,529 Views)

Not sure about just how you wish it all to work (The other Boolean lables?)

 

But try this.

 

Does your bar code reader pass in a line feed. My barcode readers are all setup to pass in a line feed so I do not require the user to click on an "OK" button. I make it so that after they have the barcode scanner in their hand, they do not have to put it down to grab the mouse just to click OK. If so then set the Up Date While Typing to false.

 

If they are manually typing in the barcode using the keyboard, the user hit the enter key to tell the VI when they are done. Again not requiring them to move their hands from the keyboard to the mouse and then move to pointer to the OK button

 

I then check the string using a regular expression for a valid string. If not I loop back around and ask again.

I do include a Cancel button for the user to abort that is linked to the Esc key,  

 

 

Omar
0 Kudos
Message 4 of 10
(3,522 Views)

@PeterPoPS wrote:

 

Why does this VI become unresponsive if I start it and then click somewhere on the front panel of it, without having typed anything in the string control or done anything else!

 


 

You probably have your event case for mouse down set to "Lock front panel until Event completes".

 

Message 5 of 10
(3,519 Views)

Ahh yes, next time I'll post the VI!

 

Shouldn't it be stucked in the while loop and the event stucture not even "loaded"?

0 Kudos
Message 6 of 10
(3,513 Views)

Omar II: Didn't know about the line feed future! Thanks!

 

Anyway I want it to work like this:
The user scans a barcode, the okay button changes label to "OK (in 5 second(s)...)" and counts down to "OK (in 1 second(s)...)". It checks the expression if it's okay its okay, else it returns an error to the main VI.

 

The user also has the possibility to click somewhere on the front panel, this stops the count down and the user now has the possibility to enter what ever in the string control and bypass the expression check

0 Kudos
Message 7 of 10
(3,508 Views)

 


_peter__ wrote:

Shouldn't it be stucked in the while loop and the event stucture not even "loaded"?


It is stuck in the while loop, but your event structure IS "loaded" but can't service any event because it is stuck in the while loop and Ravens Fan is most likely right, your front panel is locked - "Lock front panel until Event completes" is checked.

 


_peter__ wrote:

Omar II: Didn't know about the line feed future! Thanks! 


That should be a setup function of your bar code scanner.

Are you using the count down because you could not tell when the barcode reader was done and wanted to make sure you were getting all of it? The line feed will fix that.

 

Is the string check also used to check that the bar code reader was done and that you are getting all of it?

 

Or do you need to detect if the string was entered by the barcode reader or by a human typing?

Different rules appy for the barcode read vs the human typing?

The barcode has a fixed format, but the human typing can be anything.

 

Omar
0 Kudos
Message 8 of 10
(3,503 Views)

Ravens Fan wrote:

You probably have your event case for mouse down set to "Lock front panel until Event completes".


Ah yeah, that'll get you too.

 

That check box needs to be about 5x the size and flash red. Smiley Very Happy

0 Kudos
Message 9 of 10
(3,491 Views)

Omar II:

Yes that is the default setup of the barcode scanner, I just didn't realize that the scanner also produces a line feed.

 

The count down is made for the user to check if the barcode is scanned and to have an option to manually enter something.

 

If you mean the string check in the loop its just to notify when the barcode reader started, I'll wait 500ms in the sequence just to make sure everything is read (the barcode is on the form ABC12345). But now this is changed so I'll wait for the Line feed in the while loop and then its done.

 

How ever, if you click the front panel and abort the count down, you can manually enter something and then no rules what so ever applies to the input and that's how i want it.

 

So basically:

Scan using the barcode and let 5s elapse => The format of the scanned code is checked.

Click somewhere on the front panel before 5s elapsed => Enter what ever as input and the input is not checked.

 

 

 

 

0 Kudos
Message 10 of 10
(3,479 Views)