Re: Writing a preference pane that configures hotkeys?
It doesn't look like NDHotKeyControl implements a setReadyForHotKeyEvent: method. Do I perhaps have an older version of the NDHotKeyControl source code? Surely there is something I'm missing here. I figure I can take your word for it on this, since you wrote the class and all. ;-) - Brian On Wed, 26 Mar 2008 09:56:01 -0400, Nathan Day [EMAIL PROTECTED] wrote: I use those classes myself in a preference pane (Popup Dock) and they work fine. You need to have a NDHotKeyControl to capture the event, you can create an input field in IB and change its class to NDHotKeyControl. You then need to tell the NDHotKeyControl to wait for a HotKey combination event by calling setReadyForHotKeyEvent:, you can alternativly set up a button to send a readyForHotKeyEventChanged: action. On 26/03/2008, at 12:38 AM, Brian Kendall wrote: On Mon, 24 Mar 2008 01:46:27 -0400, Jens Alfke [EMAIL PROTECTED] wrote: Take a look at Nathan Day's NDHotKeyEvent utility code: http://homepage.mac.com/nathan_day/pages/source.xml I tried to use this in my preference pane, but I can't get the control to receive hot key events. There could be something I'm doing wrong when setting up or working with the NDHotKeyControl class, but is there any reason it wouldn't be able to receive events in a preference pane? - Brian ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com This email sent to [EMAIL PROTECTED] Nathan Day [EMAIL PROTECTED] http://homepage.mac.com/nathan_day/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Writing a preference pane that configures hotkeys?
On Mon, 24 Mar 2008 01:46:27 -0400, Jens Alfke [EMAIL PROTECTED] wrote: Take a look at Nathan Day's NDHotKeyEvent utility code: http://homepage.mac.com/nathan_day/pages/source.xml I tried to use this in my preference pane, but I can't get the control to receive hot key events. There could be something I'm doing wrong when setting up or working with the NDHotKeyControl class, but is there any reason it wouldn't be able to receive events in a preference pane? - Brian ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Writing a preference pane that configures hotkeys?
I'm trying to write a preference pane that allows the user to specify a hotkey. Ordinarily I would override sendEvent in NSApplication, but since it's a preference pane that's not possible in this case since the System Preferences application is already instantiated. Obviously this is possible, since many other preference panes do this, including the Keyboard Mouse pref pane. What's the propper way to go about doing this? - Brian ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Writing a preference pane that configures hotkeys?
Sorry - perhaps I wasn't clear enough. This is a preference pane for a background application, which actually registers the hot key with the system. The preference pane just needs to have some kind of button or text field so that the user can input *which* hotkey they want the background app to use. Unfortunately, that requires lower level access to what keys are being pressed than I know how to get in a preference pane. I could use an event tap, but that seems like it's way too low level, and I suspect that there must be an easier, more cocoa friendly way. All I need is for the pref pane to be able to intercept one keystroke, complete with modifier keys, like in the Keyboard Mouse pref pane, though it doesn't necessarily have to work the same way. I've seen other 3rd party preference panes record keystrokes for hotkeys after pressing a button, so obviously it's possible. I just don't know quite how. - Brian On Sun, 23 Mar 2008 22:34:16 -0400, Andrew Farmer [EMAIL PROTECTED] wrote: On 23 Mar 08, at 19:26, Brian Kendall wrote: I'm trying to write a preference pane that allows the user to specify a hotkey. Ordinarily I would override sendEvent in NSApplication, but since it's a preference pane that's not possible in this case since the System Preferences application is already instantiated. Obviously this is possible, since many other preference panes do this, including the Keyboard Mouse pref pane. What's the propper way to go about doing this? Create a helper app that runs in the background. Preference panes only exist while they're open, so registering a hotkey there doesn't do you much good. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Writing a preference pane that configures hotkeys?
Ah, that looks perfect! Thanks! I'll try it out tomorrow. - Brian On Mon, 24 Mar 2008 01:46:27 -0400, Jens Alfke [EMAIL PROTECTED] wrote: On 23 Mar '08, at 7:26 PM, Brian Kendall wrote: I'm trying to write a preference pane that allows the user to specify a hotkey. Take a look at Nathan Day's NDHotKeyEvent utility code: http://homepage.mac.com/nathan_day/pages/source.xml The description is: This is a class for providing access to carbon hot keys from Cocoa, as well as acting as instances that represent particular hot key combinations, the class object provides some methods for managing all of the hot keys created with NDHotKeyEvent. NDHotKeyEvent can send messages from both key down events and key up events and there is also a informal protocol to notify the target class when the NDHotKeyEvent instance is going to change target. The NDHotKeyEvent project also comes with a class called NDHotKeyControl which can be used for obtaining hot key combinations from the user. It sounds like NDHotKeyControl is what you want for the configuration UI in your pref-pane. (I haven't used any of this code; I just happened to bookmark it a few days ago.) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]