• 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: Keyboard Events in Modal NSWindow (Part 2)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keyboard Events in Modal NSWindow (Part 2)


  • Subject: Re: Keyboard Events in Modal NSWindow (Part 2)
  • From: Jason Barker <email@hidden>
  • Date: Sat, 22 Apr 2006 16:36:39 -0600

On Apr 22, 2006, at 4:09 PM, Shawn Erickson wrote:


On Apr 22, 2006, at 3:02 PM, Jason Barker wrote:


On Apr 22, 2006, at 9:27 AM, Jason Barker wrote:

I have a document-based application with a modal window. I want to handle keyboard events with my modal window (which has a delegate). How can I do this? Do I have to use a subclass of NSWindowManager? What is the best route? I will have a few sheets associated with this modal window. Any suggestions?


Thanks, Jason

(Newbie frustrations...)

I've accomplished what I wanted to do but I'm sure that any seasoned Cocoa/Objective-C developer will roll their eyes at this. I took a NSButton from the controls palette in IB, put it on the layout of my modal window, and created a command-keystroke combo for it. Now, my modal window allows me to type command-Equals, which is linked to an action. So that I can learn how it should be done, can anyone tell me how I should have accomplished this?

Personally I am having a hard time understanding what you are trying to do. What are you trying to do with keyboard input? What is the target of this keyboard input? What is the purpose of the modal window? (you really do mean modal right? [1])


So not really understanding what you are trying to do ... all I can recommend is reviewing the following...

<http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/CoreAppArchitecture/chapter_7_section_6.html>

-Shawn

[1] <http://developer.apple.com/documentation/Cocoa/Conceptual/ WinPanel/Concepts/UsingModalWindows.html>


Sorry,

In one sentence: I want a user to be able to type command-_whatever_ from within a modal window so that my application can detect that event and perform some action.

I've been reading some of the documentation on Apple's site about NSWindowController, modal windows, event responders and event messages in the responder chain and I'm not making much sense of it. So, I thought to just add a button, set up the key equivalent of it, move it out of view in the window, and it works. But I'd rather learn how to do it the right way. Does anyone have a small sample project I could study?


Thanks, Jason _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Keyboard Events in Modal NSWindow (Part 2)
      • From: PGM <email@hidden>
References: 
 >Keyboard Events in Modal NSWindow (From: Jason Barker <email@hidden>)
 >Re: Keyboard Events in Modal NSWindow (Part 2) (From: Jason Barker <email@hidden>)
 >Re: Keyboard Events in Modal NSWindow (Part 2) (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Keyboard Events in Modal NSWindow (Part 2)
  • Next by Date: Re: Keys of the kingdom
  • Previous by thread: Re: Keyboard Events in Modal NSWindow (Part 2)
  • Next by thread: Re: Keyboard Events in Modal NSWindow (Part 2)
  • Index(es):
    • Date
    • Thread