Re: Dragging inside and outside of a view
Re: Dragging inside and outside of a view
- Subject: Re: Dragging inside and outside of a view
- From: Simon Stapleton <email@hidden>
- Date: Tue, 24 Sep 2002 19:41:20 +0200
OK.
I thought I had this cracked.
Pretty simple really - add (and maintain) a tracking rectangle for the
visible part of the view (the main pain here being that the view can
exist either standalone or as a part of a scrollview, but that's not
too hard to sort out), and then on a mouseExited check to see if the
user is dragging and start the drag and drop mechanisms up (and reverse
on mouseEntered). I've already got a 'userActivityType' instance
variable, so that's easy.
Except...
I get no mouseEntered or mouseExited events if I've got a button
depressed. I'm not shortcircuiting the event handling mechanism here,
there's nothing (of mine) that goes modal on dragging. As far as I can
see, I should get mouseExited/mouseEntered events as well as the
standard mouseDragged ones, but maybe I'm wrong - it's happened before
;-)
Is this the way it's supposed to be? - there seems to be nothing in the
docs to indicate so.
FWIW I'm using Jaguar and the latest tools - don't have another machine
available to check this out under 10.1
Simon
On Monday, Sep 23, 2002, at 11:48 Europe/Paris, Simon Stapleton wrote:
Hi
Current project involves a graphical editor view (somewhat similar to
that of OmniGraffle) for layout and connection of arbitrary (well,
dynamically loaded, anyway) items. Think UML editor (not that it is,
but similar functionality). Anyroadup, it's all working quite nicely
- I can drag objects in from a palette, have popup menus working for
the view and (where provided) the objects, selction, box selection and
dragging within the view are all 100%. Nice.
However. I have a few little additions that I want to add, as follows:
- Where dragging of selected items goes out of the view _but is still
inside the window_, scroll (and dynamically resize the view if
necessary) to allow the objects to be dropped within the view.
- Where dragging of selected items goes outside of the window, shove
details of the seleted items onto the pasteboard (in
application-specific format to allow dropping onto other views in the
same application, in image format for graphical destinations, and in
RTF and text formats for textual destinations. Oh, and creation of
files for finder might be nice, too, just to drop a fly or two into
the ointment ;-) If this was an UML editor, think the ability to drag
to the finder to create files for the selected objects, drag to (for
example) PBX for class definitions, to (again, for example) preview
for a printable object diagram...
My drag handling is currently internal to the view - I'm using
-mouseDown: and -mouseUp: to pick up the start and end of internal
drags for undo/redo purposes, and doing the actual dragging in
-mouseDragged:
I'm 'rolling my own' rather than using full drag-drop functionality
here as it allows live redrawing of connections to non-selected items.
however, I suspect that I'm going to need to move to full drag and
drop for all this functionality in order to cover the requirements
above - I don't want to have to use (solely) cut and paste, 'export
as' etc. to cover that as drag and drop seems so much more usable. I
don't want to resort to modifier keys on the drag, either.
Any ideas how I can keep my live redrawing _and_ get drag and drop
working to external targets? I'm sure I'm missing something stupid.
Simon
--
PGP Key Id : 0x50D0698D
--
Well, we finally have an indoor toilet. But what new disasters have
struck the Alpenproject?
Find out at : <http://www.tufty.co.uk/Move/index.html>
--
PGP Key Id : 0x50D0698D
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.