• 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: How to create an NSEvent for Option-E?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create an NSEvent for Option-E?


  • Subject: Re: How to create an NSEvent for Option-E?
  • From: Uli Kusterer <email@hidden>
  • Date: Wed, 30 Aug 2006 19:40:08 +0200

Am 29.08.2006 um 23:03 schrieb Glen Simmons:
NSEvent* fakeEvent = [NSEvent keyEventWithType:NSKeyDown
location:NSZeroPoint
modifierFlags:0x80120
timestamp:0
windowNumber:[[NSApp mainWindow] windowNumber]
context:nil
characters:@""
charactersIgnoringModifiers:@"e"
isARepeat:NO
keyCode:14];
[NSApp postEvent:fakeEvent atStart:NO];


This throws an exception: *** -[NSCFString characterAtIndex:]: Range or index out of bounds

Why? What's wrong with this code? How can I send an event for Option-E?

I guess AppKit isn't prepared to get an empty string for the characters: parameter? Why do you need to do this anyway? What is Option-E? On my keyboard, that's the Euro-sign, so you'd neither want to use this as a keyboard shortcut, not would you want to use a fake event to generate the character (Because it may be different depending on the keyboard, and NSEvent won't auto-fill the characters: param, which can cause application code to detect this as the wrong key...).


 What are you trying to do?

Cheers,
-- M. Uli Kusterer
http://www.zathras.de


_______________________________________________ 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: How to create an NSEvent for Option-E?
      • From: Glen Simmons <email@hidden>
References: 
 >How to create an NSEvent for Option-E? (From: Glen Simmons <email@hidden>)

  • Prev by Date: Re: Strange NSSlider / NSUserDefaults interaction
  • Next by Date: Re: Posting commands?
  • Previous by thread: How to create an NSEvent for Option-E?
  • Next by thread: Re: How to create an NSEvent for Option-E?
  • Index(es):
    • Date
    • Thread