sending focus to next field

Bob Sneidar bobs at twft.com
Mon Jun 18 13:38:58 EDT 2012


Works great so long as you only have fields, but sooner or later it is going to focus on your button. What I have done is on openCard I build a list of fields whose names match a criteria, such as starting with "fld" whose locktext is false. I save it in a property. 

When I want to set the focus, I find my current field in the list, and then set the focus to the next object in the list. This has the added advantage of being able to run a "tab order" procedure to change the tab order of objects without changing their ID's. I also intercept the tab key in the card script and follow the above method instead of letting LC do it. 

Bob


On Jun 16, 2012, at 1: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.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list