Re: Installing multiple hotkeys in app
Re: Installing multiple hotkeys in app
- Subject: Re: Installing multiple hotkeys in app
- From: "Dale Gillard" <email@hidden>
- Date: Mon, 05 Jan 2004 09:51:52 +1000
Hi Bill
Thanks for the reply. Just to clarify what's happening - both sets of hot
keys are being registered, but the first registered handler is being
called when either set of keys is being pressed.
<
http://lists.apple.com/mhonarc/cocoa-dev/msg15026.html>.
>
I haven't parsed your code carefully, but I do notice one significant
>
difference between the way you're doing it and the way I do it. I declare
>
the following as global variables, whereas you declare them locally: the
>
UInt32 hot key identifiers, the UInt32 hot keys, the eventHotKeyRefs, the
>
EventHotKeyID, the EventHandlerUPP, and the handler function. I don't recall
>
whether this makes a difference, but I think that at least some of them do
>
have to be declared globally.
Originally these variables were declared globally in my code too, but I
moved them into one block to limit the scope of the variables to to
ensure that the specific hot keys were being correctly registered and
alos to make it easier for the list to read. Interestingly, my code works
the same even when the variables are not declared globally.
>
There are two sets of sample code from Apple for hot keys. One is
>
UIElementInspector. I don't recall the other.
The other example is FunkyOverlayWindow. I've based my code of these two
examples, but neither installs multiple hot keys. It seems I'm going to
have to go back over them to look for differences to my code and
experiment a bit.
>
One thing I believe any app should do, if it implements global hot keys, is
>
to provide a preference where the user can change the hot keys in case this
>
sort of conflict arises. You can see the UI that I implemented for this by
>
downloading the trial version of PreFab UI Browser
>
<http://www.prefab.com/uibrowser> and looking at the Hot Keys tab in
>
Preferences.
This is next on my list of things to do, once I've got multiple global
hot keys working. I like your UI in PreFab UI Browser. I was aware of the
possibility of a conflict with other programs, and at the least was going
to add a Enable Hot Keys checkbox to my preferences. Ideally, I'd like to
allow the user to set their own hot keys so I'll also have to look at
displaying/converting keys to key codes.
Thanks again.
Dale Gillard
--
Dale Gillard
email@hidden
--
http://www.fastmail.fm - Does exactly what it says on the tin
_______________________________________________
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.