• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSEvent window question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Problem creating an NSButton subclass in Java
  • Next by Date: Novice: signal 10 memory errors
  • Previous by thread: Re: [Newbie]: Trouble with NSURLHandle
  • Next by thread: NSScanner problem...
  • Index(es):
    • Date
    • Thread