• 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: Services and Windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Services and Windows


  • Subject: Re: Services and Windows
  • From: Ryan Britton <email@hidden>
  • Date: Wed, 8 Feb 2006 14:01:13 -0800

Are you wanting this to trigger the window regardless of the app in the foreground or is it only specific to your app? If the former, subclassing NSApplication will not work. You need to look into the HotKeys API in Carbon.

http://www.dbachrach.com/blog/2005/11/program-global-hotkeys-in-cocoa- easily.html


On Feb 8, 2006, at 1:28 PM, David Rogers wrote:

I have a little program that provides a service. The service pops up a window and lets you choose from a list, then pastes that value into the current document.

The problem that I have is that I want the window to only remain open while the keyboard shortcut for the service is still held down. i.e. cmd-shift-E. Once the keys are released then I want the window to be hidden again.

I'm pretty sure that I need to subclass NSApplication and set that as my Principal Class, but I'm not quite sure where to go from there. So far, Google and ADC haven't given me the info that I need.

Here's what I have for my subclass so far. If anyone has any hints, they would be greatly appreciated!

Thanks in advance,

David Rogers


@implementation AppController
- (void)sendEvent:(NSEvent *)event
{
switch ([event type])
{
case NSKeyUp:
if (([event modifierFlags] & NSCommandKeyMask) && ([event modifierFlags] & NSShiftKeyMask)) {
NSLog(@"Command and Shift held");
}
break;
default:
break;
}
[super sendEvent:event];


}
@end




_______________________________________________ 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

_______________________________________________ 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
References: 
 >Services and Windows (From: David Rogers <email@hidden>)

  • Prev by Date: Re: outlineViewItemDidCollapse
  • Next by Date: Re: Core Data copying and pasting
  • Previous by thread: Services and Windows
  • Next by thread: Re: Services and Windows
  • Index(es):
    • Date
    • Thread