[comp.sys.mac.hypercard] Cursor location after text added to field

smaass@all41.csc.ti.com (02/16/90)

Is there someone who can help resolve this question about function keys in
HyperCard?

I am trying to use a function key to add an ASCII string to a field.  The
problem that I run into is that the cursor keeps ending up in the message box
rather than at the end of the field. Here is what the function looks like:

on functionkey x
  if x is 1 then put "testing number 1" after background field 3
  else if x is 2 then put "testing number 2" after background field 3
end functionkey

I have also tried adding:
  click at background field 3

but that highlighted the whole field rather than moving to the end of the
field.

Is there an easy way to do this?

Sincerely,
Sue Maass

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (02/17/90)

In article <188@all41.csc.ti.com> smaass@all41.csc.ti.com writes:
>I am trying to use a function key to add an ASCII string to a field.  The
>problem that I run into is that the cursor keeps ending up in the message box
>rather than at the end of the field. Here is what the function looks like:
>
>on functionkey x
>  if x is 1 then put "testing number 1" after background field 3
>  else if x is 2 then put "testing number 2" after background field 3
>end functionkey

To put the cursor in a field, use one of the following:

 select text of field "foo" -- to select the entire field contents
 select after text of field "foo" -- to put the cursor at the end of the field
 select before text of field "foo -- you get the idea

You can also select chunks within a field, e.g.

 select word 3 of field "foo"

To place the insertion point at a specific location within a field, use
the chunk expression for an empty selection. For instance, to place the
insertion point between character 10 and 11, use

 select char 11 to 10 of field "foo"
-- 
====== jeanne a. e. devoto ========================================
 jdevoto@apple.com  |  You may not distribute this article under a
 jdevoto@well.UUCP  |  compilation copyright without my permission.
___________________________________________________________________
 Apple Computer and I are not authorized  |        CI$: 72411,165
 to speak for each other.                 |  AppleLink: SQA.TEST