on keyDown pKey
if pKey is a number
then pass keyDown
else beep
end keyDown
i need to insert float number and so on... i tried to write integer or real or float instead number but i get an error...
Can somebody help me?
Kindest regards
Luca
pKey (entering a number)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: pKey (entering a number)
Hi Luca,
welcome to the forum!
Your script works here, I can only type numbers into the field.
So no idea what your problem is?
Best
Klaus
P.S.
Personal note:
A little "Hello" or something would not have hurt for the very first posting.
welcome to the forum!
Your script works here, I can only type numbers into the field.
So no idea what your problem is?
Best
Klaus
P.S.
Personal note:
A little "Hello" or something would not have hurt for the very first posting.
-
- Posts: 3
- Joined: Sat Nov 28, 2020 2:56 pm
Re: pKey (entering a number)
Thanks a lot,Klaus!
But the problem come if i try to insert a decimal number...
But the problem come if i try to insert a decimal number...
Re: pKey (entering a number)
AHA!
OK, do this:
Tested and works!
Best
Klaus
OK, do this:
Code: Select all
on keyDown pKey
## All numbers are allowed:
if pKey is a number then
pass keyDown
else
## Only ONE decimal point allowed, so we have to check:
if pKey = "." AND "." is not in me then
pass keydown
else
beep
end if
beep
end if
end keyDown
Best
Klaus
-
- Posts: 3
- Joined: Sat Nov 28, 2020 2:56 pm
Re: pKey (entering a number)
Many many thanks,Klaus!
Kindest regards!
Luca
Kindest regards!
Luca