[comp.sys.mac.programmer] Mouse tracking on PICTS

wrp@biochsn.acc.virginia.edu (William R. Pearson) (08/14/88)

	I have an application where the results of a calculation can be
displayed as text or as a graph (PICT).  To display the results, I would
like to have a text window and a PICT window open, and allow the user to
click on a line in the PICT, retreive some information about where he
clicked, and then center the text window around that point.

	Any suggestions on how to get information on where a mouse-down (up)
with regard to a structure (line, rectangle, etc) in a PICT?  This seems
to happen all the time when draw programs move parts of the picture.

Bill Pearson
wrp@virginia.EDU

oster@dewey.soe.berkeley.edu (David Phillip Oster) (08/15/88)

Use the quickdraw bottleneck procedures: 
1.) Inititialize the bottleneck procedures to the standard values.
2.) replace the bottleneck procedures with your own.
Your bottleneck procedures should convert the components of Apple's PICT
to some more tractable representation. (I use a linked list of variable
sized NewHandle() records.)
3.) DrawPicture in this grafport. as the PICT flows passed, your
bottleneck procedures will get called. See the QuickDraw chapter of
Inside Macintosh Don't  forget to handle the semi-standard PicComments (See
the Tech Notes for more information.)
4.) set the bottleneck procedures back to the standard values.
5.) you might as well discard the PICT representation at this point, since
you've got everything you need to replicate it.
6.) when you get a mouse down, search against your linked list
representation of the picture.

Don't forget Color Quickdraw, if the program might run on a mac II. You
may decide to do nothing, but at least you should consider the question.

--- David Phillip Oster            --When you asked me to live in sin with you
Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth.
Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu