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

Services and Windows


  • Subject: Services and Windows
  • From: David Rogers <email@hidden>
  • Date: Wed, 8 Feb 2006 15:28:38 -0600

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
  • Follow-Ups:
    • Re: Services and Windows
      • From: glenn andreas <email@hidden>
    • Re: Services and Windows
      • From: Ryan Britton <email@hidden>
  • Prev by Date: Connecting Menu Items to Actions
  • Next by Date: Re: Connecting Menu Items to Actions
  • Previous by thread: Re: Connecting Menu Items to Actions
  • Next by thread: Re: Services and Windows
  • Index(es):
    • Date
    • Thread