I am programming in Cocoa. When the window opens, I would like the window's origin to move to where the mouse is.
This is basically the exact same implementation as connecting outlets in Interface Builder.
I already have a IBAction function that is called to open a window, I just need to find the cursor's coordinates.
So, where the * is, I need to input the mouse coordinates.
Is this how I should tackle this problem?
Thanks for your help guys.
This is basically the exact same implementation as connecting outlets in Interface Builder.
I already have a IBAction function that is called to open a window, I just need to find the cursor's coordinates.
Code:
- (IBAction)open:(id)sender {
[self makeKeyAndOrderFront:self];
if (!isOpen) {
if (windowSetsOriginToMouseOnOpen) {
[self setFrameOrigin:*];
}
if (windowFades)
[[self animator] setAlphaValue:1.0];
else
[self setAlphaValue:1.0];
isOpen = YES;
}
}
So, where the * is, I need to input the mouse coordinates.
Is this how I should tackle this problem?
Thanks for your help guys.