Is there any way of making an NSButton draggable? I mean like in the final built application, the user can drag the NSButton.
I'm trying to do something almost "Dashboard" style... like draggable things. At the moment, I'm just using NSButtons that stay in place, but it'd be nice if they could be dragged around.
NSButton normally eats up all mouse events. Therefore you must subclass NSButton and override not only the dragging handling but also the click handling:
- (void)mouseDown:(NSEvent *)theEvent
{
[self highlight:YES];
}
- (void)mouseDragged:(NSEvent *)event
{
// start a dragging session
}
- (void)mouseUp:(NSEvent *)theEvent
{
[self performClick:self];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With