Formatting entries in the fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Formatting entries in the fields
Hi,
You can have a formatting entries in the fields when digit?
eg: 00:00:00
thanks
You can have a formatting entries in the fields when digit?
eg: 00:00:00
thanks
Re: Formatting entries in the fields
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
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
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
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 ...link76 wrote: Thanks for the function! but I want to set a format native to the field text entry, how can I do?

Guglielmo
Re: Formatting entries in the fields
you have any ideas?gpb01 wrote: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 ...link76 wrote: Thanks for the function! but I want to set a format native to the field text entry, how can I do?
Guglielmo
Can you speak Italian?
-
Luca
Re: Formatting entries in the fields
To make a "restricted" entry field, you have to add code yourself. For example:
Note that this example allows entries like "99::13:323424:", so you have to add more "if then-end if" clausels.
Code: Select all
on keyDown thePressedKey
if thePressedKey is in "0123456789:" then
pass keyDown
end if
end keyDown
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Formatting entries in the fields
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)link76 wrote: ...
Can you speak Italian?
-
Luca

(for English speakers : "Yes Luca, Italian is my mother tongue, but, for respect to others, only outside this forum)
Guglielmo