Page 1 of 1
Formatting entries in the fields
Posted: Fri Jun 22, 2012 3:09 pm
by link76
Hi,
You can have a formatting entries in the fields when digit?
eg: 00:00:00
thanks
Re: Formatting entries in the fields
Posted: Fri Jun 22, 2012 6:45 pm
by dunbarx
There are several native formats, for example, the long time is of the type you showed. "xx:xx:xx"
But I think you want to validate general formatting, no? You must use the "itemdelimeter" to create your own format. I do not know how you intend to use this, either for data entry or for data validation.
So, for example if you need data entry in that form, you might check an entered value as follows:
ask "Enter data"
answer checkFormat(it)
function checkFormat var
set the itemDelimiter to ":"
if item 1 of var is a number and item 2 of var is a number and item 3 of var is a number then
return var
else
return "Invalid Format"
end if
end checkFormat
This is a bit wordy, but I hope you get the idea. There are about a dozen other ways to do this. Write back if this is not what you had in mind at all.
Craig Newman
Re: Formatting entries in the fields
Posted: Sat Jun 23, 2012 9:06 am
by link76
dunbarx wrote:
There are several native formats, for example, the long time is of the type you showed. "xx:xx:xx"
Craig Newman
Thanks for the function! but I want to set a format native to the field text entry, how can I do?
Re: Formatting entries in the fields
Posted: Sat Jun 23, 2012 11:47 am
by gpb01
link76 wrote:
Thanks for the function! but I want to set a format native to the field text entry, how can I do?
There is not "native format" for a field (
use the inspector to see what you can set) ... you have to write your own function to format and verify as you like ...
Guglielmo
Re: Formatting entries in the fields
Posted: Sat Jun 23, 2012 12:38 pm
by link76
gpb01 wrote:link76 wrote:
Thanks for the function! but I want to set a format native to the field text entry, how can I do?
There is not "native format" for a field (
use the inspector to see what you can set) ... you have to write your own function to format and verify as you like ...
Guglielmo
you have any ideas?
Can you speak Italian?
-
Luca
Re: Formatting entries in the fields
Posted: Sat Jun 23, 2012 2:04 pm
by BvG
To make a "restricted" entry field, you have to add code yourself. For example:
Code: Select all
on keyDown thePressedKey
if thePressedKey is in "0123456789:" then
pass keyDown
end if
end keyDown
Note that this example allows entries like "99::13:323424:", so you have to add more "if then-end if" clausels.
Re: Formatting entries in the fields
Posted: Sat Jun 23, 2012 3:03 pm
by gpb01
link76 wrote:
...
Can you speak Italian?
-
Luca
Si Luca, l'Italiano รจ la mia lingua madre ... ma, per rispetto verso gli altri, solo al di fuori di questo forum (guglielmo (at) braguglia.ch)
(
for English speakers : "Yes Luca, Italian is my mother tongue, but, for respect to others, only outside this forum)
Guglielmo