• 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: NSTextView & Tabs ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView & Tabs ...


  • Subject: Re: NSTextView & Tabs ...
  • From: Ashley Clark <email@hidden>
  • Date: Tue, 5 May 2009 11:55:00 -0500

On May 5, 2009, at 9:42 AM, Mic Pringle wrote:

I'm working on a project that accepts user input via an NSTextView
instance, but I would like to have a user-defined number of spaces
inserted when the tab key is pressed. Similar to how TextMate allows.

What is the best way to acheive this ? NSLayoutManager or key press events ?

Any help will be greatly appreciated.

One way to accomplish this would be to implement this method on your NSTextView delegate (typed in Mail, YMMV):


- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector
{
if (commandSelector == @selector(insertTab:)) {
[textView insertText:spacesForTabsString];
return YES;
}


    return NO;
}


Ashley _______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >NSTextView & Tabs ... (From: Mic Pringle <email@hidden>)

  • Prev by Date: Re: A tree data structure?
  • Next by Date: [iPhone] tab bar and navigation combined...
  • Previous by thread: NSTextView & Tabs ...
  • Next by thread: [iPhone] tab bar and navigation combined...
  • Index(es):
    • Date
    • Thread