LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Prompt User for input - enter key approve

Guess what.  You also have two shift keys, two control  keys, and two alt keys.  They are two different keys as seen by the vkey code, but actually are the same key as they do the same function.

 

On my keyboard both the key on the alphanumeric part and the key on the number pad both say "Enter".  They do the same thing.  They do have two different vkey codes.

 

Early computer keyboards, the key on the typing area was called "Return".  That was derived from the "carriage return" function of electric typewriters.  At that time "enter" would not have made any sense since there was nothing to "enter" into a typewrite.  That key was called "return" and was needed to give the functionality that a typewriter needed to "return the carriage" back to the beginning of the line which was what the big bar did on manual typewriters.

 

I think early computer keyboards said "return", but over the years as typewriters have become a distant memory, keyboard manufacturers have just started printing "enter" on that key.

0 Kudos
Message 11 of 21
(2,288 Views)

RavensFan I agree with all that, except that Enter and Return DO act differently when inputting text.

 

willcan, I literally just realized something. You could have just left it as an Express VI and the way not to have to click the OK button would be to press Tab then Enter/Return.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 12 of 21
(2,265 Views)

@FireFist-Redhawk wrote:

RavensFan I agree with all that, except that Enter and Return DO act differently when inputting text.

 

willcan, I literally just realized something. You could have just left it as an Express VI and the way not to have to click the OK button would be to press Tab then Enter/Return.


I have never seen them act differently.  And what precisely do you mean by "inputting text"?  What application are you working with.

 

Tell me how they do.

0 Kudos
Message 13 of 21
(2,262 Views)

Make a free label, subdiagram label, string control/constant, anything like that, and start inputting text (typing in stuff). Press Return and it will put you one line down, press Enter and it will "finish" or "submit" the text, the text cursor will go away, and you won't be able to add more text unless you click it again.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 14 of 21
(2,255 Views)

Interesting.  I've never noticed that before.

 

1.  I've never seen another program distinguish between the two.

2.  If I am doing labels in LabVIEW, I'm typing text and will hit the enter key on the typewriter area rarely and only if I need to do a multi-line comment.  Then I'd click off and do something else when done.  I would never hit the enter key in the number pad area when doing comments.

 

The only time I use the enter key in the numpad area is when I'm entering values into cells in Excel.

0 Kudos
Message 15 of 21
(2,227 Views)

On basically every other program I've used, they do function the same, and the way to get that different behavior is with a modifier+Return/Enter.

 

1. Entering text in an Excel cell? Alt+Return/Enter gets you down a line. Ctrl+R/E and Shift+R/E act the same as just R/E.

2. Typing a comment or message on Facebook? Ctrl+R/E or Alt+R/E or Shift+R/E.

3. Sending a message in Skype? Shift+R/E. Ctrl+R/E will actually call them, oddly enough. And Alt+R/E does absolutely nothing!

4. And back to LabVIEW, Ctrl+Return = Enter.

 

We're digressing hard on this gentleman's post, but yeah I've just been testing on different programs to figure out most of what I just mentioned. Very interesting indeed.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 16 of 21
(2,226 Views)

Hi redhawk , 

 

one more query ! 

 

If operator enter a string characters which includes the special character means . I  need to block or give a alert to him as " don't enter special characters it was invalid" like that . 

 

so how to block or check  the string input which includes the special characters . 

using search string, i need to enter all special characters ? or some other method ?

 

0 Kudos
Message 17 of 21
(2,179 Views)

Hi willcan,

 


@willcan wrote:

one more query ! 

If operator enter a string characters which includes the special character means . I  need to block or give a alert to him as " don't enter special characters it was invalid" like that . 

so how to block or check  the string input which includes the special characters . 


Use an event structure to capture keypress filter events of that string control: now you can disable any char/key you like very easily…

 

On that Return/Enter difference in LabVIEW:

  • Yes, in string controls <Return> inputs a linebreak in the string. <Enter> ends input. You can set the string control to "Limit to single line" and both keys act the same.
  • Return/Enter also behave different when defining rings/enum items in their properties dialog…
  • Also take care of that 2nd item in the "Environment" settings in the LabVIEW options!

There are some places where LabVIEW takes advantage (IMHO) of using both keys.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 21
(2,176 Views)

@willcan wrote:

 

If operator enter a string characters which includes the special character means . I  need to block or give a alert to him as " don't enter special characters it was invalid" like that . 

 


No, don't alert the user, just make sure that only valid characters can be entered.

Typically you would use a filtering "key down?" event and discard the input.

 

Here is a very old example that only allows up to 8 printable characters. It can easily be adapted for your purpose.

 

 

 

0 Kudos
Message 19 of 21
(2,156 Views)

Hi willcan,

 

To add onto what GerdW and altenbach said, yes you basically want a Key Down? event for your string that you want filtered, and filter out what you consider special characters base on their ASCII codes, like this:

 

FireFist-Redhawk_1-1594923945689.png

 

 

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 20 of 21
(2,137 Views)