• 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
Re: panels, windows, and the 'esc' key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: panels, windows, and the 'esc' key


  • Subject: Re: panels, windows, and the 'esc' key
  • From: Ron Fleckner <email@hidden>
  • Date: Wed, 21 Feb 2007 16:02:55 +1100


On 21/02/2007, at 3:59 PM, PGM wrote:

Nearly every user function/command in my app can be done by using one key only. It makes the app very easy to use one handed and without the mouse, which is a relatively important part of it's design. I know I can subclass NSWindow and override -keyDown:, and I've done that for the main window. If I have to, that'll be the way I go. But the fact that one of the windows does what I'd like already without me being able to work out why is driving me nuts.


I do not know why one of your windows behaves differently, but you can make the window respond to keyboard shortcuts in a relatively easy way by adding a transparant dummy button in an unused corner of your window, the action of which you connect to the close-method of your window (or orderOut), and give that button the required keyboard shortcut.


If you don't want this button to be clickable you will have to do something like this:

//PMDummyButton.h
#import <Cocoa/Cocoa.h>
@interface PMDummyButton : NSButton {

}
@end

//PMDummyButton.m

#import "PMDummyButton.h"

@implementation PMDummyButton

- (void)mouseDown:(NSEvent *)theEvent
{
	//do nothing
}

@end

Hmm... sounds interesting. I might do that if I can't figure out how to do it in Interface Builder.


Thanks for the suggestion.

Ron
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >panels, windows, and the 'esc' key (From: Ron Fleckner <email@hidden>)
 >Re: panels, windows, and the 'esc' key (From: PGM <email@hidden>)

  • Prev by Date: Re: panels, windows, and the 'esc' key
  • Next by Date: Re: MDImporters Help
  • Previous by thread: Re: panels, windows, and the 'esc' key
  • Next by thread: Change the text color.
  • Index(es):
    • Date
    • Thread