Page 1 of 1

Additionnal event for imagegadget?

Posted: Fri Jan 31, 2014 12:39 am
by Poshu
I need to move some imagegadgets around my window by dragging them with the mouse. Granted Canvasgadget would be much more adapted for that kind of work, but I need some transparency too...
Do you know how to get an event for mouse left button down from an imagegadget?

Edit:

Code: Select all

// -------------------- MOUSE EVENTS ------------------- \\ 

- (BOOL) acceptsFirstMouse:(NSEvent *)theEvent
{
	return YES;
}

- (void)mouseDown:(NSEvent *)theEvent
{
	lastDragLocation = [theEvent locationInWindow]; 
}

- (void)mouseDragged:(NSEvent *)theEvent
{
	NSPoint newDragLocation = [theEvent locationInWindow];
	NSPoint thisOrigin = [self frame].origin;
	thisOrigin.x += (-lastDragLocation.x + newDragLocation.x);
	thisOrigin.y += (-lastDragLocation.y + newDragLocation.y);
	[self setFrameOrigin:thisOrigin];
	lastDragLocation = newDragLocation;
}
the objective C version of what I need (I guess)