[comp.soft-sys.andrew] Fetching mouse click

hans@triumph-adler.de (Hans von Kleist-Retzow) (10/17/90)

We are implementing an extension of ez. There we created a second
window and show in this window a translation of the text in the first
window. Now we want to fetch the mouse click, so that we can scroll
in the second window to the correct place. In which class (we think
that it should be a ..._Hit method) and method will the cursor be set,
when the user clicks on a position in the text.

Can you please help us.

Thanks, Hans
----------------------------------------------------------------------
Hans von Kleist-Retzow, TA Triumph-Adler AG, Olivetti DOR Research lab
Fuerther Str. 212, D-8500 Nuernberg 80, West-Germany
Tel: +49 911 322 6355	E-Mail: hans@triumph-adler.de

gk5g+@andrew.cmu.edu (Gary Keim) (10/18/90)

Excerpts from misc: 16-Oct-90 Fetching mouse click Hans
Kleist-Retzow@trium (677)

> In which class (we think
> that it should be a ..._Hit method) and method will the cursor be set,
> when the user clicks on a position in the text.

I'm not exactly sure what you asking.

If you're asking, "Where in the text object does the cursor position get
set when a user clicks on some text?",  the answer is
textv.c:textview__Hit().  There is some code at the top of that method
that sets the cursor:

	if (action == view_LeftDown)  {
	    mark_SetPos(self->dot, newLeftPos);
	    mark_SetLength(self->dot, newRightPos - newLeftPos);

If you're asking, "After a hit in some text, how can we get the current
cursor {location,length}?,  the answer is:

	textview_GetDotPosition(textv);
	textview_GetDotLength(textv);

Gary Keim
ATK Group

janssen@parc.xerox.com (Bill Janssen) (10/18/90)

A possible way to do this is to create a new view subclass that simply
puts up a textview to fill its entire area.  The new view's Hit method
will pass on the mouse click to the subview (textview containing the
original text), then find out where the text cursor is in the subview,
then signal the other part of the application (which has the translated
text).  Shame keystrokes don't go through some similar mechanism.

Bill