[ont.micro.mac] Cursor Programming

info-mac@utcsrgv.UUCP (info-mac) (06/19/84)

Date: 15 Jun 1984 1505-PDT
Subject: Cursor Programming
From: Mike Schuster <uw-beaver!MIKES@CIT-20>
To: info-mac@SUMEX-AIM.ARPA

Now that Bill Croft's SUMacC has been distributed, I guess <info-mac>
will be subjected to more programming questions and info.  May I?

[Ed. By all means! Thats what this list in intended for.]

When text editing, the shape of the cursor may be either 'ibeam' or
'arrow' depending if the cursor is pointing to text or not.  The
obvious code to handle cursors tests to see if the cursor position is
within some rectangle containing the text.  If so, the cursor is set
to ibeam, otherwise it is set to arrow.  This position test is
repeatedly performed in the main event loop of the program, even if no
mouse or other events occur.

Unfortunately, this simple scheme will not always work correctly.  For
example, suppose you have just selected a time consuming command like
Save from the File menu.  While your file is being saved, you quickly
try to pull down the File menu once again, holding the mouse button
down as you move the cursor to the expected position of the command
you now wish to invoke. You keep holding the button down until the
save is finished and the menu actually appears.  Don't let go of the
button and look at the shape cursor.  It should be an arrow, but using
the above code, it might be an ibeam if the cursor is over text.

Can someone suggest a better way to handle cursor shapes?

Another question: When editing programs or tabular data, its handy if
some rectangular region of text can be cut, copied, pasted, indented,
etc.  Does the Text Edit Manager have hooks so that such selections
could be implemented?

Mike
(mikes@cit-20)
-------

info-mac@utcsrgv.UUCP (info-mac) (06/22/84)

Date: Wed, 20 Jun 84 11:28 PDT
From: uw-beaver!Piersol.pasa@XEROX.ARPA
Subject: Re: Cursor Programming
In-Reply-To: "MIKES@CIT-20.ARPA's message of 15 Jun 84 15:05 PDT"
To: Mike Schuster <MIKES@CIT-20.ARPA>
Cc: info-mac@SUMEX-AIM.ARPA

The difficulty with such 'rectangular' selections comes when a variable
width font is used.  As many of us have experienced, columnar output
doesn't line up very well if the font is something like New York.  This
means that a selection out in the white space at the end of lines has an
indeterminate value.  Since tab marks on this kind of editor are pixel
based rather than column based, they also pose problems with this sort
of selection.  Only with the assumption of fixed width fonts do
'rectangular' selections become easy to implement and use.

Kurt