Re: Getting a command key before it is interpreted by the menus
Re: Getting a command key before it is interpreted by the menus
- Subject: Re: Getting a command key before it is interpreted by the menus
- From: Gideon King <email@hidden>
- Date: Tue, 27 Apr 2004 13:09:21 +1000
I have successfully hooked in to the Carbon events associated with
menus and that side of things seems to be working ok but when I change
things in the menus on the carbon side of things, although they are
displayed in the application, when I use the Cocoa NSMenu class, it
doesn't recognize that I have changed anything (when I list my menus,
it shows all the original items, but no added or changed items).
I have tried all the methods I can find on the Cocoa and Carbon side of
things to get things in sync again, but haven't found a solution yet.
For my particular problem, I believe I should be able to solve the
problem in either of 2 ways:
1. get the cocoa NSMenu to recognize that the underlying carbon menu
has changed (this would be my preferred option)
2. work out how I could access the menu tag values in carbon
If anyone knows how to accomplish either of these things, I'd be very
grateful for the tip
Thanks
Gideon
On Saturday, April 24, 2004, at 12:50 AM, Kay Roepke wrote:
On 23. Apr 2004, at 16:23 Uhr, Gideon King wrote:
Hi, I have a situation in my application where I would like to
intercept command key combinations before they are processed by the
menu system. In the archives, people say to override NSApplication's
sendEvent: method. This works if the menu is not currently open, but
if the user has the menu open, the command key events never make it to
sendEvent: I looked at the documentation and saw NSMenuView, and
thought I could override keyDown: there, but then I noticed that the
documentation says that it is obsolete and no longer used, but it
doesn't say what it has been replaced with. I see references in other
postings to a carbon menu manager, but don't see how to get at that or
how to interact with it in my app.
AFAIK the menu stuff is still(again?) completely in Carbon. Thus the
event handling would also be in Carbon (for that part of the
application). That would me you'd have to get inside the event tracking
runloop of the menu code and somehow short circuit
that. I have to admit that I don't have a clue about Carbon (;-)), but
that's very probably what happens...
I'd look into GetMenuEventTarget and InstallEventHandler described in
http://developer.apple.com/documentation/Carbon/Reference/
Carbon_Event_Manager_Ref/CarbonEventsRef/APIIndex.html
So maybe some Carbon people can elaborate...
Kay
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.
_______________________________________________
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.