[comp.sys.mac.programmer] Selection in TE

weyand@csli.Stanford.EDU (Chris Weyand) (07/07/90)

I'm writing an application that selects text (using TextEdit) from
the keyboard (e.g. select word,sentence, ...)  There doesn't seem to
be any way of extending a selection without calling TEClick.  Is
this correct?  The only solution I could come up with was to call TEClick
(passing TRUE for extending selection) with the proper point.  I thought
TEGetPoint would convert my offset into the proper point but it doesn't!
When I call TEClick(TEGetPoint(myoffset,macTE),TRUE,macTE) it actually
gets a click at the right horizontal position but the vertical position
is off by a line Ends up in next line).  This is really a hack I'd much rather
have an extend selection function.

Anyone have any help?

Thanks
Chris Weyand
weyand@csli.Stanford.edu

mxmora@unix.SRI.COM (Matt Mora) (07/10/90)

In article <14358@csli.Stanford.EDU> weyand@csli.Stanford.EDU (Chris Weyand) writes:
>I'm writing an application that selects text (using TextEdit) from
>the keyboard (e.g. select word,sentence, ...)  There doesn't seem to
>be any way of extending a selection without calling TEClick.  Is
>this correct?  The only solution I could come up with was to call TEClick

I might be missing the point but why can't you use:

 TESetSelect(selStart, selEnd, te);

If you don't know what the previous selction range is you can do something
like:

selstart:=te^^.selstart;
selEnd:=te^^.selend;

{calculate your new offset, being a word, sentance or char}

TESetSelect(selStart, selEnd, te);

I can't believe Apple didn't include a TEGetSelect call. And I thought Apple
was against accessing the data structures directly. Yet in IM vol I pg 377
they state: "Some TextEdit features are available only if you access fields of
the edit record directly."

Well anyway I hope I anwsered what you were asking.


>Anyone have any help?
>
>Thanks
>Chris Weyand
>weyand@csli.Stanford.edu


-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________