[comp.sys.acorn] Dragging a Draw object

walther@econ.vu.nl (Walther Schoonenberg/10000) (06/14/91)

I'm writing a commercial application in C in which a draw file is rendered in
a window. Something essential is still missing. What I want to do is select an
object with the mouse and dragging it to a new position. How do I program this,
especially if I do not want to hog the whole machine before I release the
mouse button. Can someone who already programmed this, send me an example
source (or give me some useful hints)? Thanks in advance.

==============================================================================
Walther Schoonenberg
Vakgroep Econometrie
Faculteit der Econonomische Wetenschappen en Econometrie   *       *    * * *
Vrije Universiteit                                         *   *   *   *
De Boelelaan 1105                                          *   *   *    * *  
1081 HV Amsterdam                                          *   *   *        *
The Netherlands                                              *   *     * * *
(020) 5483609                                              walther@econ.vu.nl
==============================================================================

gilbertd@p4.cs.man.ac.uk (Dave Gilbert) (06/18/91)

In <779@.econ.vu.nl> walther@econ.vu.nl (Walther Schoonenberg/10000) writes:


>I'm writing a commercial application in C in which a draw file is rendered in
>a window. Something essential is still missing. What I want to do is select an
>object with the mouse and dragging it to a new position. How do I program this,
>especially if I do not want to hog the whole machine before I release the
>mouse button. Can someone who already programmed this, send me an example
>source (or give me some useful hints)? Thanks in advance.

I think the way to do it is :-

When the mouse button is pressed look through your objects to find which
object you have selected - then find its bounding box, and start a user drag.
RISCOS will inform you when it has finished - then just fiddle with the
coordinates of the bounding box in your draw file.

Dave
-- 
-------------------------------------------------------------------------------
- Dave Gilbert - gilbertd@p4.cs.man.ac.uk - The MTBF of a piece of equipment  -
-                G7FHJ@GB7NWP             - is inversly proportional to its   -
------------------------------------------- importance                        -