• 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
Passing on events and the built-in functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing on events and the built-in functions


  • Subject: Passing on events and the built-in functions
  • From: Jeffrey Mattox <email@hidden>
  • Date: Wed, 12 Feb 2003 16:20:10 -0600

I have installed an event handler to get hot key events (e.g., F5) using:

RegisterEventHotKey( hotKeyCode, modifierKey, gMyHotKeyID,
GetApplicationEventTarget(), 0, &gMyHotKeyRef );

When I get the events, I may or may not pass the events on using:

theResult = CallNextEventHandler( nextHandler, theEvent );

I pass on the event if I don't want to do anything with it, and don't pass it on if I do.

I get the hot key events just fine, but I'm unable to prevent the built-in handlers for the hot keys from being invoked, too. For example, on my keyboard, F14 and F15 control the display brightness. If I return noErr from my F14 handler and don't pass it on, the brightness handler still gets triggered.

In the other hand, if I pass on the event immediately and check the result, the return from CallNextEventHandler() is always eventNotHandledErr, indicating that the event was not handled, even though some action was taken (evidenced by a brightness change). Regardless of the hot key, the return in all cases (for all the hot keys), is eventNotHandledErr.

So, it makes no difference what I return, or whether or not I pass on the event, the internal operations are still performed. If I pass on the event, I cannot determine if an action was taken.

What could I be missing, or is there a better way to do this?

Jeff
_______________________________________________
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.

  • Prev by Date: Re: seeking advice on NSComboBox and view display problems
  • Next by Date: layout management and cocoa
  • Previous by thread: NSComboBox allows no selection?
  • Next by thread: layout management and cocoa
  • Index(es):
    • Date
    • Thread