sending focus to next field

Richmond richmondmathewson at gmail.com
Sun Jun 17 10:07:27 EDT 2012


On 06/16/2012 11:02 PM, Richmond wrote:
> On 06/16/2012 10:49 PM, Dr. Hawkins wrote:
>> OK, today's kindergarten question, to which I think I knew the answer
>> once upon a time (but then, i thought that I used to use "send some
>> message to every field in this card" . . .).
>>
>> I want to be able to leave a field and focus to the next field, just
>> as if tab were hit, from within a script.  I've tried sending tab as a
>> message to the field, and sending it to the card with a tick delay.
>>
>> Surely this is easy . . .
>>
>>
>
> I have just made a merry little stack with 3 fields all in a row.
>
> And a button containing this script:
>
> on mouseUp
>   put the id of the focusedObject into fOB
>   put (fOB + 1) into fOB
>   focus on fld id fOB
> on mouseUp
>
> and, oddly enough, it shifts the focus down the line of fields, one 
> per click.
>
> Have a lovely weekend.  Richmond.

However, I haven't had such a super weekend as something began to niggle 
at my mind last night:

What if the sequence of fields is interupted by a button or other control?

Tried this and had NO JOY:

on mouseUp
   put the id of the focusedObject into fOB
repeat until control id fOB is a field
   put (fOB + 1) into fOB
end repeat
   focus on fld id fOB
on mouseUp

the 'repeat' line "threw a bluey" (is: bad validation type)

replaced 'is' with '=' . . . same old sh*t.

What am I missing?





More information about the use-livecode mailing list