Another Dumb Field Problem!

Lynch, Jonathan bnz2 at cdc.gov
Wed Aug 24 13:58:27 EDT 2005


My pleasure,

Use this wording:

  Select before field 1


That will place the cursor at the top of the field. The difference
between our two scripts is that your method is using the field number,
and my method is using the field name. For my method to work, the fields
have to actually be named with the same first word, such as "myField 1"
, "myField 2" , etc...

Using field number is ok, as long as their layer properties correspond
to their vertical location in the group. If you go into the group after
you have created it, and add a new field that is located between two
other fields, then be sure to reset their layer properties so that they
correspond to their vertical location in the group. Otherwise, you will
wind up jumping to the wrong field.

By the way, my original script can be modified so that you can have
other fields in the same group that are not part of the series. I tested
this script, and it works perfectly. I will send the test stack to you
offlist, so you can see how it is implemented:

On tabkey
  Put the short name of the target into tField
  Put word 1 of tField into tFieldName
  Put word 2 of tField into tFieldNumber
  Put 0 into tFieldCount
  Repeat with X = 1 to the number of fields in me
    If word 1 of the short name of field X of me = tFieldName then add 1
to tFieldCount
  End repeat

  If the shiftkey is down then
   If tFieldNumber > 1 then
     Subtract 1 from tFieldNumber
   Else
     Put tFieldCount into tFieldNumber
   End if
  Else if the commandkey is down then
    If the selectedfield <> empty then
      Put Tab into the selection
      Exit tabkey
    End if
  Else
    If tFieldNumber < tFieldCount then
      Add 1 to tFieldNumber
    Else
      Put 1 into tFieldNumber
    End if
  End if
  Put tFieldName && tFieldNumber into tNewField
  Select before field tNewField of me
End tabkey

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of David
Burgun
Sent: Wednesday, August 24, 2005 1:32 PM
To: How to use Revolution
Subject: RE: Another Dumb Field Problem!

Hi,

I couldn't get your Scripts to work, but I modified it as below and 
it works fine now. It replies on the fields being alone on a group 
(inside the parent group). It seems to work fine except I don't want 
the text inside the field to be selected as in:

   select char 1 to -1 of field myFieldNumber of me

How can I get the cursor to move to the next field BUT not have the 
contents selected?

Thanks a lot
Dave


------------------------------------------------------------------------
-------
--
--  tabKey
--
------------------------------------------------------------------------
-------
on tabKey
   local myFieldNumber
   local myNewField
   local myNumberOfFields
   local myTargetFieldNumber

   put the number of the target into myTargetFieldNumber
   put the number of me into myFieldNumber
   put myTargetFieldNumber - myFieldNumber into myFieldNumber
   put the number of fields in me into myNumberOfFields

   if the shiftKey is down then
     if myFieldNumber > 1 then
       subtract 1 from myFieldNumber
     else
       put myNumberOfFields into myFieldNumber
     end if
   else
     if myFieldNumber < myNumberOfFields then
       add 1 to myFieldNumber
     else
       put 1 into myFieldNumber
     end if
   end if
   select char 1 to -1 of field myFieldNumber of me
end tabKey





>Oops, made a simple obvious mistake, here is the revised version of
that
>script:
>On tabkey
>   Put the short name of the target into tField
>   Put word 1 of tField into tFieldName
>   Put word 2 of tField into tFieldNumber
>   If the shiftkey is down then
>    If tFieldNumber > 1 then
>      Subtract 1 from tFieldNumber
>    Else
>      Put the number of fields in me into tFieldNumber
>    End if
>   Else if the commandkey is down then
>     If the selectedfield <> empty then
>       Put Tab into the selection
>       Exit tabkey
>     End if
>   Else
>     If tFieldNumber < the number of fields in me then
>       Add 1 to tFieldNumber
>     Else
>       Put 1 into tFieldNumber
>     End if
>   End if
>   Put tFieldName && tFieldNumber into tNewField
>   Select char 1 to -1 of field tNewField of me
>End tabkey
>
>
>
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your 
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list