Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer Help > Re: respond to ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 14 Topic 3731 of 3882
Post > Topic >>

Re: respond to cmd+w

by Gregory Weston <uce@[EMAIL PROTECTED] > May 8, 2008 at 08:32 AM

In article 
<e3edac8f-936f-4005-b901-867f8a2c6780@[EMAIL PROTECTED]
>,
 p2 <pradip.patel@[EMAIL PROTECTED]
> wrote:

> On May 5, 3:29 pm, Gregory Weston <u...@[EMAIL PROTECTED]
> wrote:
> > In article
> > <986b1cb2-90f2-4014-a874-a030d49e1...@[EMAIL PROTECTED]
>,
> >
> >  p2 <pradip.pa...@[EMAIL PROTECTED]
> wrote:
> > > On May 3, 3:34 pm, Gregory Weston <u...@[EMAIL PROTECTED]
> wrote:
> >
> > > > I mean define a new subclass of NSView which knows (because it's
an
> > > > NSResponder and you've overridden the method that controls the
response
> > > > to key equivalents) what to do when Cmd-W is pressed. Then make
the
> > > > window's content view an instance of that subclass in the nib
file.
> >
> > > > Of course the window itself is also a responder, so you could go
that
> > > > route instead of changing the content view. You just end up
sending the
> > > > resulting message to self instead of [self window].
> >
> > > But i am not getting cmd+w key event altogether in keyDown as well
as
> > > flagsChanged.
> > > Is there any thing to do to get cmd+w altogether ?
> >
> > Yes. You need to override how your custom class responds to key
> > equivalents. Read the NSResponder do***entation. It's a class with
which
> > you should really familiarize yourself.
> 
> Thanks for continuing sup****t,
> I have read the NSResponder & Event mechanism in cocoa.
> In my case, cmd+w comes under Key equivalents and it handled by
> overwriting performKeyEquivalent:
> Application send it to NSView and subviews and then after NSButton,
> NSMenu etc..
> but it is not come under my overwritten performKeyEquivalent method.
> 
> Below are some details abt my custom class.
> My custom class is derived from NSWindowController and also i set
> NSWindow delegate to ny custom class.
> 
> How can i get this event in my custom class ? Is any thing missing ?

Yes. You're missing the fact that I noted multiple times that you should 
subclass NSView or NSWindow for this behavior. It has to be an 
NSResponder subclass and it has to be in the active responder chain.

-- 
"Harry?" Ron's voice was a mere whisper. "Do you smell something ...
burning?"
   - Harry Potter and the Odor of the Phoenix
 




 14 Posts in Topic:
respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-02 03:28:37 
Re: respond to cmd+w
Gregory Weston <uce@[E  2008-05-02 07:46:26 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-03 00:07:42 
Re: respond to cmd+w
Gregory Weston <uce@[E  2008-05-03 06:34:10 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-04 22:48:18 
Re: respond to cmd+w
Gregory Weston <uce@[E  2008-05-05 06:29:51 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-08 04:40:24 
Re: respond to cmd+w
Gregory Weston <uce@[E  2008-05-08 08:32:20 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-08 05:47:35 
Re: respond to cmd+w
Gregory Weston <uce@[E  2008-05-08 14:30:35 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-08 21:54:36 
Re: respond to cmd+w
Gregory Weston <uce@[E  2008-05-09 10:18:38 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-11 22:19:39 
Re: respond to cmd+w
p2 <pradip.patel@[EMAI  2008-05-12 05:27:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 10:20:45 CST 2008.