ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match pattern string

I have aattached VI. trying to make a basic calculator. (staretd making it, first I want to get correct string from user.)

When user enter decimal(.), it should not be able to enter decimal again.

I have made code in which a string match pattern is used to check if decimal is already present. if present then do not add it otherwise add it.

Although whenever I press decimal, match pattern always return true. Don't know why?

0 Kudos
Message 1 of 7
(4,369 Views)
Why are you using a string for a numeric entry? That just seems like a Rube Goldberg.
0 Kudos
Message 2 of 7
(4,359 Views)
Never mind. I see you want to use a keypad for numeric entry.
0 Kudos
Message 3 of 7
(4,341 Views)

I want to make a calculator as in windows. for learning purpose

0 Kudos
Message 4 of 7
(4,324 Views)
  • The terminals of latch action buttons belong inside their respective event cases.
  • The string belongs into a shift register. No need for local variables
  • The character "." has a special meaning. You need to escape it. See the help. Use "\." as search term instead, then append "." to the string if needed.
  • You can delete the timeout case.
  • There is no event for the "2" button.
0 Kudos
Message 5 of 7
(4,295 Views)

I cannot use string roll over. Since I am making a calculator as in windows 10. Right now I am making standard version of calc as on windows(Alt+1 press on window calc to open standard version)

If I keep on entering string as such, then it can enter can alphabet A-z,0-9. 

In attached VI, currently I have made a part where user can enter string upto 16 places (as in window calc)

 

Now problem is string eneterd in my VI can be any for example: +0.968, +098.8, -9.89

Now I have to display 0.968,+98.8,-9.89 for above strings.

 

1. How to do that?

2. Currently I can enter numbers by clicking on VI butons only. How can I enter them by pressing button on keyboard also?

 

0 Kudos
Message 6 of 7
(4,199 Views)

You can use the Key Down event with a case structure:

 

Key Down.png

0 Kudos
Message 7 of 7
(4,181 Views)