In article
<1ffbbb10-2c3d-4d60-a6c0-3bbfeb689715@[EMAIL PROTECTED]
>,
p2 <pradip.patel@[EMAIL PROTECTED]
> wrote:
> On May 2, 4:46 pm, Gregory Weston <u...@[EMAIL PROTECTED]
> wrote:
> > In article
> > <b25ee72c-1881-4ac1-b1b0-5ded5b0e4...@[EMAIL PROTECTED]
>,
> >
> > p2 <pradip.pa...@[EMAIL PROTECTED]
> wrote:
> > > Hi
> >
> > > I am creating window without menubar. The controller class is
derived
> > > from NSWindowController.
> >
> > > How can i respond cmd+w command to close the window?
> >
> > > If menubar is there then default cmd+w is there in file menu. So
> > > without menubar how can i achieve this ?
> >
> > Make the window's content view a custom class that responds to cmd-w.
>
> Hi
> Thanks for responding.
> I am not getting what you are trying to say ..
> does you mean : add custom controll to window which handle cmd+w. ?
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].
--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ...
burning?"
- Harry Potter and the Odor of the Phoenix


|