• 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: customizing TextView keyboard responses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: customizing TextView keyboard responses


  • Subject: Re: customizing TextView keyboard responses
  • From: Gideon King <email@hidden>
  • Date: Wed, 19 Dec 2001 07:03:57 +0800

Would overriding keydown give you what you wanted? Something like:

- (void)keyDown:(NSEvent *)event {
NSString *characters = [event charactersIgnoringModifiers];
// If they pressed the Tab key, we do something special
// A unichar is a typedef of unsigned short (NSString.h)
unichar c = [characters characterAtIndex:0];
if (c == 9) // tab
{
// Do your special stuff - you can also check modifierFlags if you need to
unsigned int modFlags;

modFlags = [event modifierFlags];

if (modFlags & NSAlternateKeyMask)
{
// Do something different if they pressed the option key
} else {
// Whatever needs to be done - we have now acted on the keystroke, so probably want to bale out
return;
}
}
// Pass on the key binding manager to be acted on in the normal way.
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}

On Wednesday, December 19, 2001, at 01:04 AM, Matt Neuburg wrote:

At 11:24 AM -0500 12/18/01, Jim Correia wrote:

At 8:07 AM -0800 12/18/01, Matt Neuburg wrote:

How do I customize a TextView so that when the user types a Tab key into
it, it tabs to the next key view (like a TextField) rather than entering
the tab into the text? Thx - m.


<http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/
ObjC_classic/Classes/NSText.html#//apple_ref/occ/instm/NSText/setFieldEditor:
>

should do the trick.

No, it's more complicated than that, because I want Return characters to be
entered as usual. I don't want a TextField; I want a TextView with just
this one customized bit of behavior. m.
--

matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes gar anthropoi tou eidenai oregontai phusei
_______________________________________________
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.


References: 
 >Re: customizing TextView keyboard responses (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: customizing TextView keyboard responses
  • Next by Date: window background color
  • Previous by thread: Re: customizing TextView keyboard responses
  • Next by thread: Re: customizing TextView keyboard responses
  • Index(es):
    • Date
    • Thread