Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

a script to enter numbers like a calculator does? [onscreen keypad entry]


This topic is 3362 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi fmforums!

I'm looking to enter numbers like a calculator does this time round...

The idea:

Script to enter number from onscreen button in this case [1]

firstly, get the quantity variable as text - eg [2] items

then add the character 1 to the variable - eg [21]

then convert the text back to a number [convert to integer]

and drop it back into the quantity box - eg [21] items

I found a custom function that works from brian dunning's website - but it *is* a custom function.

AddTextRight

If there is a way to script it without calling the custom function - it would help me greatly.

here's an example of the script I'm presently using:


Set Error Capture [On]

Set Variable [$A; Value:GetAsText (PrescanInput::Quantity)]

Set Variable [$B; Value:AddTextRight ($A ; 1 ; "1")

Set Field [PrescanInput::Quantity; Int ($]

Commit Records/Requests []

Set Error Capture [Off]

I've also attached an image to show the idea in context - keypad.jpg

If anyone can shed light on how I could do this without a custom function, I would be grateful.

Chris

keypad.jpg

Posted

I don't know whether it has been a hard week but I am having trouble understanding what you require.

Do you just need the number [e.g. 21] inserting in the white field via the on-screen keyboard? If so, I think your script can be simplified without any custom functions.

Or do you require something completely different?

Posted (edited)

Users would need to see the data being entered so I wouldn't use variables unless you get more complex and use layout variables with triggers. But you can use a global field (from anywhere), name it gQuantity and script would be:

Set Field [ gQuantity ; gQuantity & Get ( ScriptParameter ) ]

then create your first button 1 and attach that script. As the parameter type 1. Copy and duplicate for all your buttons then just change the script parameter on each one to parameter 2, parameter 3 etc.

When ready to set the real quantity field attach script to your button of:

Set Field [ Quantity ; gQuantity ]

Set Field [ gQuantity ; "" ]

Edited by Guest
  • 4 years later...
Posted

LaRetta, I know this is an old topic but it is close to what I want to achieve. My Question is this. Using your above example it only holds 1 digit not in the example case 2 digits (21) in other words by placing the scripts on each button when that button is depressed the global changes to the stored parameter value so getting double or triple digit numbers doesn't work. Am I missing something? or am I just not reading this as a solution to this double digit question? I am using it as a possible solution for a POS system at a register.

This topic is 3362 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.