Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Spike099

macrumors regular
Original poster
Feb 18, 2007
143
0
Canada
Alright! I've got to ask it now! Err.

I've been trying to implement in house drag and drop so I can mimic some behavior found in IB (resizing, snapping etc).

This is how i've done it so far.

When a user clicks on an image in the main window, another window appears ( the drag window ). An image is drawn in the window to mimic the image in the main window.

When the user now drags the drag window "should" now be key and receive mouse events. But it isn't. I have to click again to so it can receive mouseDragged events.

The window appears as it should using [window makeKeyAndOrderFront]; but because it wasn't the window receiving the mouseDown event, it isn't receiving mouseDragged. I've tried [window sendEvent:prevMouseDownEvent].

Is this possible? "while a mouse event is directed at whatever window lies under the pointer" - Apple Docs
So... It should work in theory according to the docs.
 
Okay, I got it working...

Not entirely the way I wanted, but it works...

The image that responds to the mouseDown:event and pulls up the window also responds to mouseDragged/mouseUp and passes the events to the other window...
 
JLNDragEffectManager

I wrote a Cocoa class called JLNDragEffectManager that handles morphing between two images during drag just like dragging from Interface Builder's library palette into a window. It's BSD licensed.

I wrote an article to explain its design and use here. I also wrote an article showing how I use it in one of my own products here.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.