A problem with Return in a field

Devin Asay devin_asay at byu.edu
Mon Dec 11 11:10:25 EST 2006


Charles,

(I've been following this discussion on the use-rev list, so I'm  
taking the liberty to post it there too.)

I suspect your problem may be related to the fact that you have a  
keyDown handler in the field that may be blocking the return key.   
(Although it's not supposed to.) It should work if you force the  
return key to "tab" to the next field by including a returnInField  
handler:

on returnInField
   get the number of me
   select the text of fld (it + 1)
end returnInField

Anybody know why the keyDown handler blocks the autoTab? Maybe a  
candidate for bugzilla?

Devin

On Dec 9, 2006, at 6:45 PM, Charles Szasz wrote:

> Devin,
>
> I have been working on my project since June. I almost done but I  
> ran into an unexpected problem. When the user enters a raw score of  
> two digits in a field and presses the Tab key, the cursor goes to  
> the next edit field as it is supposed to do. When the user presses  
> the Return key after entry of a two digit number, the number is  
> pushed off to the left and the cursor remains in the field.  This  
> happens despite the autotab being set to true and no list behavior  
> is checked.
>
> Here is a sample script from my project:
>
>
> ON keyDown whichKey
>   IF whichKey is a number THEN
>     IF the selection is not empty THEN delete the selection
>     IF the length of me < 2 THEN
>       pass keyDown
>     ELSE
>       answer information "Numbers cannot be longer than two digits."
>     END IF
>   END IF
> END keyDown
>
> ON closefield
>     IF field "yrFld" > 4 AND field "yrFld" < 12 AND fld "msFld" >  
> 62 THEN
>         answer information "The total raw score is incorrect for a  
> age of " && fld "yrFld" &" years!"
>         put empty into me
>         focus ON me
>     ELSE
>         IF field "yrFld" > 11 AND field "yrFld" < 20 AND fld  
> "msFld" > 63 THEN
>             answer information "The total raw score is incorrect  
> for a age of " && fld "yrFld" &" years!"
>             put empty into me
>             focus ON me
>         ELSE
>             IF field "yrFld" > 19 AND field "yrFld" <60 AND fld  
> "msFld" > 57 THEN
>                 answer information "The total raw score is  
> incorrect for a age of " && fld "yrFld" &" years!"
>                 put empty into me
>                 focus ON me
>             END IF
>         END IF
>     END IF
> END closefield
>
>
> The first script limits the input of  2 digit numbers only. The  
> second script is flagging the possibility of an incorrect raw score  
> being entered for certain ages. Some of the fields have a raw score  
> limit based on the age of the child. For this example, children  
> aged 5 to 11 years, the total raw score can be only 62. for  
> students in the age range of 12 to 19, the total is 63 and for  
> adults (20 to 59 years) the total is 57.
>
> The questions remains is why does the Return key does not act as a  
> Tab key?
>
> Charles Szasz
> cszasz at mac.com
>
>
>

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University



Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list