LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

On-Screen Keyboard and a String Control

Solved!
Go to solution

I am experiencing some odd behavior when I use the On-Screen keyboard (OSK) and a string control.

 

I am developing a application that will need to use the OSK to enter in some data on a touch screen monitor with no physical keyboard. I have a Event-Driven State Machine set up to the Key Down event when a word/characters are entered and the user presses the Enter Key on the OSK. I noticed if I probe the VKey wire wuen I press the Enter Key on the OSK, it comes across as a Return press. No big deal I thought, just see if the Return Key is pressed and continue on.

 

When I went to test my program, I noticed that my values were displaying as if nothing was entered. Digging a little further, I noticed that my original data is still there if I press the Backspace Key and remove the Return command. Probing the string wire within the string control indicates that that the value comes back as a empty string in my string control even though my entire string is physically still there. I can press the backspace key (deleting the carriage return) and see my original text. What I think is happening is when I press the Return Key on the OSK, it inserts something and moves my text either up or down and when I use the property node to extract the data within the string control, I get a empty string.

 

How have you gotten around this? I'd like to hear your solutions.

0 Kudos
Message 1 of 9
(4,982 Views)

Probably should have sent my VI along. Don't mind the subVIs.

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

It looks like you have a pretty well laid out program there with a state machine, and the Event Driven state.

 

I can't run your program, so I can't see what is working and what isn't working.  But one thing I am not seeing, related to your questions, is how the data being entered on the On Screen Keyboard is actually being entered into the control.  I see how the control gets key focus.  But how to you back out of the on screen keyboard?  How do you get the keyboard entry to finish and cause the data to "stick" in the control?  I'm guessing that hitting a virtual Enter on the on screen keyboard doesn't translate to hitting a real enter on the control that will finish editing and cause the data to stick.  What if when you hit enter you cause the key focus to go elsewhere?

 

One other thing I noticed.  You are using a fast running while loop checking Time Elapsed to hold the code for 2 seconds.  Just use the Time Delay Express VI to wait 2 seconds and you don't need the while loop and still have the same effect of waiting.

Message 3 of 9
(4,931 Views)
Solution
Accepted by Eric1977

Have you tried right-clicking the string control (assuming it's "Mold ID to Enter"), and setting it to "Limit to Single Line"? Sounds like your settings cause hitting enter to add a line shift instead of finishing your input. (You can also edit the "return behavior" in your LabVIew Settings)

Best regards,

Jarle Ekanger, MSc, PhD, CLD
Flow Design Bureau AS

- "The resistance of wires in LabVIEW is not dependent on their length."
0 Kudos
Message 4 of 9
(4,910 Views)

Eric1977

 

not sure if this will help at all but i had a similar requirement in my program. this is what i was able to use to use to save any amount of keyboard input I wanted.

 

the enter text here string can be sized to whatever you want and hidden of your vi - then referenced or variabled to wherever you need it

 

the enter key worked the same as the carriage return but it didn't amtter here as i still had to use the 'X' to close the OSK. but the string typed value stayed the same unless i called the OSK and deleted it with Backspace or Delete keys.

0 Kudos
Message 5 of 9
(4,880 Views)

Ravens,

 

Unforunately, you cannot back out of the OSK. I noticed that you'd have to be an admin to kill the OSK (according to the MSN documenation) programmaticlly so the user would have to physically press the close button on the OSK window. I can't remember where I found this, but it does state that which I found as odd.

Message 6 of 9
(4,858 Views)

Found it. Wasn't the MSN documentation, but a post on the NI Forums. Look at message #3 here: https://forums.ni.com/t5/LabVIEW/Close-OSK/td-p/2908366

0 Kudos
Message 7 of 9
(4,843 Views)

Since you marked Jarle's message as the solution, I hope it means your happy and he's helped you solve your problem.

 

I had never seen the OSK app before.  It looks like it can be very useful, but these other issues like how to programmatically get into it, or out of it with a task kill seem like they are a bit of a hack to work with something that shows so much promise.

 

If these issues are too big, consider making your home pop-up keyboard as a LabVIEW VI.  It would be a little bit of work, but not so bad.  I've made a pop-up numeric keyboard that I've used in a few apps of mine.  Of course that is fewer keys to layout and deal with.  And I didn't need decimals for what I was doing so I didn't have to program that which adds a little complication.

 

A pop-up keyboard might actually be easier, other than having 3-4 times the number of keys depending on how many symbols you need to deal with, and if you need to deal with CAPS, or CAPS lock or whatever.

 

There is also a chance that someone may have done something already.  A google search might find something.  It is likely in the NI community if it exists.  If you can find something that works or is close to what you want, it might be better than using this OSK executable.

 

Just some ideas to toss out there.

0 Kudos
Message 8 of 9
(4,832 Views)

Yes, Jarle's suggestion was the right one. I had forgotten about the limit to one line property. I also implimentd your suggestion to use the Time Delay Express VI. Thank you.

 

You are right, the OSK is a little bit like a hack to get it to close. Having to use the taskill and be an admin doesn not seem like a reliable solution. I may look into the LV keyboard.

0 Kudos
Message 9 of 9
(4,812 Views)