Re: Draggable buttons
Re: Draggable buttons
- Subject: Re: Draggable buttons
- From: "John C. Randolph" <email@hidden>
- Date: Sun, 18 Sep 2005 08:54:01 -0700
The RoundTransparentWindow example isn't really applicable to this.
To get an image of your button for dragging, use -
cacheDisplayInRect:toBitmapImageRep:, and to do the dragging
operation itself, use
dragImage:at:offset:event:pasteboard:source:slideBack:, and implement
the NSDraggingDestination protocol in the view where you want to drop
the buttons.
-jcr
On Sep 18, 2005, at 8:36 AM, John Timmer wrote:
Apple's got example code somewhere on how to create an irregular
shaped
borderless window (a quick try at searching failed). The window
allows you
to drag it around the screen on mouse down events. It's pretty
easy to
translate the basic principles to dragging a view.
The only other thing you need is for your view to check its
superview's
frame at the start of the drag, and use these as limits to keep it on
screen.
If you can't find the code, I've got a similar thing done for a
text view,
and I can send it by email off list.
Cheers,
JT
Is anyone aware of any examples overriding NSButton to create a
draggable button?
I am attempting to make a palette that the user can arbitrarily drag
and arrange buttons on.
John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden