sending focus to next field
J. Landman Gay
jacque at hyperactivesw.com
Mon Jun 18 15:31:38 EDT 2012
On 6/18/12 2:02 PM, Richmond wrote:
> On 06/18/2012 09:42 PM, J. Landman Gay wrote:
>> On 6/18/12 1:09 PM, Richmond wrote:
>>> 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? "
>>> and am still waiting for a reply that might allow me to lever my
>>> original solution.
>> The problem is that the syntax you're using isn't supported. The "is a
>> field" syntax only checks for existence. It can't be used to identify
>> if a control is of a particular type.
> That's an awful pity.
> How does one differentiate between control types?
Check if there is a field x, or if there is a btn x, etc. I'd use
numbers rather than IDs, since the engine already knows how many
controls there are and there's no need to waste time checking
non-existent IDs. There can be thousands of missing IDs in a stack.
put the number of the focusedObject + 1 into fOB -- next object number
repeat until there is a fld fOB -- may not need to run at all
put (fOB mod the number of controls) + 1 into fOB -- loops around
focus on fld fOB
This cycles around all the fields on the card. If the script is only
interested in a few of the fields, then it needs to maintain a list that
contains the field numbers or names. The repeat loop can cycle through
the items in the list and wouldn't need to check for field existence at
all; the list will only contain fields.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the Use-livecode