[comp.sys.atari.st.tech] Drawing rubber-bands

george@m2xenix.psg.com (George Emery) (05/23/91)

In drawing programs, it's common to allow lines between the mouse cursor
and a fixed point.  Another example is the rubber-band boxes for selecting
a screen area.  Would some kind soul tell me how they're done?

It's easy enough to determine the start point by using the EventMulti
loop to detect the mouse button's first click, but how does one keep
track of the mouse cursor and draw to it AND know when the mouse button
is clicked again?

Is it necessary to drop out of the EventMulti loop and use lower-level
facilities?

george@m2xenix.psg.com

warwick@cs.uq.oz.au (Warwick Allison) (05/24/91)

>In drawing programs, it's common to allow lines between the mouse cursor
>and a fixed point.  Another example is the rubber-band boxes for selecting
>a screen area.  Would some kind soul tell me how they're done?

The AES call graf_rubberbox() is one way.

>It's easy enough to determine the start point by using the EventMulti
>loop to detect the mouse button's first click, but how does one keep
>track of the mouse cursor and draw to it AND know when the mouse button
>is clicked again?

>Is it necessary to drop out of the EventMulti loop and use lower-level
>facilities?

It doesn't make much sense to stay in the EventMulti loop, since nothing
should really happen until the rubberbox is finished.  eg. What should
happen if the box extends over a desk accessory's window?  Does it get
an event?

I use graf_rubberbox() normally, but I guess you'd use VDI calls with the 
AES VDI handle if you wanted something like a rubber line.

Warwick.
--
  _-_|\       warwick@cs.uq.oz.au
 /     *  <-- Computer Science Department,
 \_.-._/      University of Queensland,
      v       Brisbane, AUSTRALIA.