NSEvent window question
NSEvent window question
- Subject: NSEvent window question
- From: John Pratt <email@hidden>
- Date: Sat, 2 Aug 2003 16:16:18 -0700 (PDT)
Hi, I just subscribed to this list.
How do I get a window to make itself focused when the
mouse enters? What I want is the window to be
draggable on the first click if the command key is
pressed. Right now, like most windows, it has to
receive a first click to become key before being
draggable.
I tried this:
- (void)mouseEntered:(NSEvent *)theEvent
{
if (theEvent modifierFlags] & NSCommandKeyMask)
{
// at this point AlphaValue is 0.0
[self setAlphaValue:0.3]; // now window is
draggable.
[self makeKeyWindow];
}
}
I do have a second, similar question if it is not too
much. In this same window, I want to make [self
setAlphaValue:0.3] happen when the command key is
pressed -after- the mouse already entered the window
as well. This is the code I used, but which did not
work either.
- (void)keyDown:(NSEvent *)theEvent
{
if ([[theEvent characters] characterAtIndex:0] ==
NSCommandKeyMask)
[self setAlphaValue:0.3];
NSLog(@"I saw a command key pressed");
}
Thanks,
John Brandon
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.