[comp.sys.mac.programmer] edit window cursor question

budd@mist.cs.orst.edu (Tim Budd) (02/24/88)

In trying to port Little Smalltalk to the Mac, I have encountered the
following problem; and need a MacExpert to tell me what I am doing wrong.

I can put up an edit window with no problem.  However, when I create
and activate another window, then when I return to the edit window
my cursor does not work correctly.  Specifically, with each mouse click it
selects all the text from the current position to the end of the window.
I even tried putting a constant false in the extend argument to TEClick,
and it still does the same thing.  There must be some bit of magic
information that is not being reset correctly, but I have no idea what it
is.

--tim budd

carlton@ji.Berkeley.EDU (Mike Carlton) (02/27/88)

In article <2856@orstcs.CS.ORST.EDU> budd@mist.cs.orst.edu (Tim Budd) writes:
...
>I can put up an edit window with no problem.  However, when I create
>and activate another window, then when I return to the edit window
>my cursor does not work correctly.  Specifically, with each mouse click it
>selects all the text from the current position to the end of the window.
...

It sounds like you forgot to convert the mouse coordinates to local 
coordinates.  TEClick requires a point in local coordinates while 
the mouse down event is in global coordinates.  Try including a 
LocalToGlobal(&event->where) before your TEClick call.

best of luck,
mike

carlton@ji.Berkeley.EDU (Mike Carlton) (02/27/88)

Oops.  In my previous reply I typed LocalToGlobal, of course that should
have been GlobalToLocal.  My fingers weren't listening again :-)

Sorry about that,
mike

jwhitnel@csi.UUCP (Jerry Whitnell) (03/01/88)

In article <2856@orstcs.CS.ORST.EDU> budd@mist.cs.orst.edu (Tim Budd) writes:
>In trying to port Little Smalltalk to the Mac, I have encountered the
>following problem; and need a MacExpert to tell me what I am doing wrong.

Good, I thought about doing it myself, but you are a much better choice.
If you need a beta site, let me know.

>
>I can put up an edit window with no problem.  However, when I create
>and activate another window, then when I return to the edit window
>my cursor does not work correctly.  Specifically, with each mouse click it
>selects all the text from the current position to the end of the window.

Without seeing the code, it's hard to guess, but here are some things to
check:

1) Are you calling TEActivate and TEDeactive on the appropiate activate events?
2) Do you call GlobalToLocal(&pt), where pt is the point you will pass to
   TEClick?  TEClick wants its points in local coordinates.
3) Is the size of the first argument to TEClick correct(a point, I think)?

I'd check these things first.  I can't think of anything else that might do
it.
>
>--tim budd

Jerry Whitnell				Been through Hell?
Communication Solutions, Inc.		What did you bring back for me?
						- A. Brilliant