sending focus to next field

Kay C Lan lan.kc.macmail at gmail.com
Sun Jun 17 21:07:48 EDT 2012


This should get you headed in the right direction

In normal fields:

on closeField
   goNextUseableField the number of me
end closeField

on exitField
   goNextUseableField the number of me
end exitField

In the Card Script: (watch for line wraps)

on goNextUseableField pNum
   put the number of flds of this stack into tMax
   repeat
      if (pNum = tMax) then
         put 1 into pNum
      else
         add 1 to pNum
      end if
      if ((the visible of fld pNum is true) and  \
         (the enabled of fld pNum is true)) then
         focus on fld pNum
         exit repeat
      end if
   end repeat
end goNextUseableField

NOTE: I tested this and it worked fine on Normal fields but not Scrolling
List fields. It would appear that closeField is not sent to Scrolling List
fields. This should not be insurmountable as other messages are available.
This is certainly a lot easier than trying to keep track of which fields
are visible/enabled and which aren't.

HTH

On Mon, Jun 18, 2012 at 3:23 AM, Dr. Hawkins <dochawk at gmail.com> wrote:

> On Sun, Jun 17, 2012 at 10:05 AM, Peter Haworth <pete at lcsql.com> wrote:
> > Since you already have already have code to hide/reveal fields depending
> on
> > context, isn't it possible to detrrmine which field needs to have focus
> in
> > that same logic and use  a "focus on field x" command?
>
> If I went to a good-sized loop/compare, yes.
>
> My fields/controls come and go in blocks.  If nothing else, I suppose
> I could creagte a table of the visible field names & ids, and circle
> around that, but it's so inelegant compared to passing a single
> message . . .
>
>
> --
> The Hawkins Law Firm
> Richard E. Hawkins, Esq.
> (702) 508-8462
> HawkinsLawFirm at gmail.com
> 3025 S. Maryland Parkway
> Suite A
> Las Vegas, NV  89109
>
> _______________________________________________
> 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