LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Text issues

Solved!
Go to solution

Kind of a strange one here.

 

In my program I have a popup dialog that asks for a work order number and you can either scan it using a barcode reader or type it in and then the program stops and turns a process station boolean true.  That part works as expected.

 

The problem is that if I type in text (but not hit enter) and press the cancel button the boolean still goes true.  But if I turn on highlighting the program works fine.  The reason I want to do this is that if an operator starts typing in a work order and then decides to hit the cancel button the boolean goes false so I do not process the station.

 

I am thinking it has to do with LabVIEW processing the text box before the cancel button.  But the cancel button had to be pushed to start processing the text.  But with the diagram highlighted it must do things different than regular runtime.  So I do not know how to get around this.

 

I have tried a few different ways and even with event structures, but could not get the boolean false if there is any text in the box when I press cancel. 

0 Kudos
Message 1 of 11
(3,052 Views)

From the String Right click menu:  Deselect, "Update value while typing"  Select "limit to single line"

 

Replace the polling loop with an event structure configured for String Value Change and Cancel value Change.

 

(Trouble:  Start manual entry then change focus and hit cancel.... There is a way around this if it is a problem you need to solve)


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11
(3,048 Views)

@JÞB wrote:

From the String Right click menu:  Deselect, "Update value while typing"  Select "limit to single line"

I have already done that

 

Replace the polling loop with an event structure configured for String Value Change and Cancel value Change.

I will have to try this 

 

(Trouble:  Start manual entry then change focus and hit cancel.... There is a way around this if it is a problem you need to solve)

Yes, this is my current problem


 

0 Kudos
Message 3 of 11
(3,035 Views)

Reading the trouble part again, that is not exactly my issue.  It is to start manual entry and then click cancel, not change focus then hit cancel. 

 

I tried using the event structure again with no luck.  I still think it might have to do with LabVIEW processing the text box before the cancel since technically the text value would register a value change as soon as the cancel button is pressed.  It seems that it should be easy to do with the original snippet I attached, unless I am missing something really simple here.

 

 

I am using LabVIEW 11.0.1f2 if that helps any.

0 Kudos
Message 4 of 11
(3,021 Views)

This is a little goofy, but it seems to work.  By adding the shift register with an additional element it lets the text box process and then on the next iteration register the cancel button.  Is this expected behavior?

 

I am still wondering why the text box and the cancel button do not process on the same iteration.  The highlight execution mode must change the way the text box is handled and process both at the same time making it work properly.  Either way unless someone can help with a better soloution this will have to work.

 

Thanks 

0 Kudos
Message 5 of 11
(3,007 Views)

There is a race condition because you can't control when the string control is read vs. the cancel button is read.

 

What you should use is an event structure.  One case handles the Cancel button value change.  The other handles the String value change.

0 Kudos
Message 6 of 11
(3,003 Views)

I tried that, but could not get it to work.  If there is any text entered in the text box when the cancel button is pressed the text gets processed first, not the cancel button.

 

Could you provide an example?  I seemed to be challenged at progrmming this afternoon. Smiley Frustrated

0 Kudos
Message 7 of 11
(3,000 Views)
Solution
Accepted by topic author _Bryan

!0.png

 

Try something along these lines.

 

(Silly snippets I need to go get the CCT AgainSmiley Embarassed.... While I'm doing that try the attached)


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 11
(2,989 Views)

@RavensFan wrote:

There is a race condition because you can't control when the string control is read vs. the cancel button is read.

 


Shouldn't the text and cancel button be read on the same iteration?  The cancel button is forcing the value change of the text box by being pressed.

0 Kudos
Message 9 of 11
(2,984 Views)

Jeff·Þ·Bohrer wrote:

Try something along these lines.

 

(Silly snippets I need to go get the CCT AgainSmiley Embarassed.... While I'm doing that try the attached)


Thanks for a starting point Jeff, I did not think it would be this difficult to do.  With my barcode scanner it works with numbers but for some reason it does not like text, it just leaves it off.  Or if I scan in all text it just stays blank.

But I will tinker with it to see if I can make it behave the way I want.

 

Thanks again.

 

0 Kudos
Message 10 of 11
(2,972 Views)