[comp.sys.mac.hypercard] Arrowkeys and HyperCard

Ken.Knight@p911.f421.n109.z1.FidoNet.Org (Ken Knight) (05/08/91)

I've got a script in a stack that makes use of the arrow keys to as a
ways to move through the stack more efficiently. According to the
Hypertalk Help stack if the TextArrows property is true arrow keys will
function as real arrow keys when used within an editable field or the
message box. I have made sure TextArrows is true, but the arrow keys
are not working as real arrows when within an editable field. Instead,
they are acting as the script (stack level) dictates they should act
and this is not desirable when editing text data. What am I doing
wrong?
 
Internet: ken.knight@f421.n109.z1.fidonet.org    AOL: KenKnight
        "Goodness me; could this be; Industrial Disease?"

 * Origin: The Clone: Macintosh Things - 301-946-8677 (1:109/421.911)

jkc@Apple.COM (John Kevin Calhoun) (05/10/91)

In article <673675360.0@blkcat.FidoNet.Org>
Ken.Knight@p911.f421.n109.z1.FidoNet.Org
(Ken Knight) writes:
>I've got a script in a stack that makes use of the arrow keys to as a
>ways to move through the stack more efficiently. According to the
>Hypertalk Help stack if the TextArrows property is true arrow keys will
>function as real arrow keys when used within an editable field or the
>message box. I have made sure TextArrows is true, but the arrow keys
>are not working as real arrows when within an editable field. Instead,
>they are acting as the script (stack level) dictates they should act
>and this is not desirable when editing text data. What am I doing
>wrong?

In describing the arrowKey message, the HyperTalk Help stack says:

  If the global property textArrows is true, the arrowKey command
  navigates through cards unless the insertion point is in a field.
  Then arrowKey moves the insertion point within the field.

  HyperCard sends the arrowKey command to the current card when
  an arrow key is pressed.  The value passed to the parameter
  variable direction will be left, right, up, or down, depending
  on which arrow key is pressed.

The important thing to note here is that there's a distinction between
the pressing of an arrow key and the sending of an arrowKey message.
When an arrow key is pressed, HyperCard _always_ sends an arrowKey
message to the current card, whether textArrows is true or false.
The textArrows property affects only what HyperCard does when it
receives an arrowKey message.

You can check in your script whether there's an insertion point --
if there is one, you can simply pass the arrowKey message, like so:

on arrowKey
  if the selectedChunk is not empty then pass arrowKey
  else
    -- do your stuff
  end if
end arrowKey


Kevin Calhoun
jkc@apple.com