• 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: insertText in NSOutlineView? (for Autolocator)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insertText in NSOutlineView? (for Autolocator)


  • Subject: Re: insertText in NSOutlineView? (for Autolocator)
  • From: Brendan Younger <email@hidden>
  • Date: Fri, 17 May 2002 09:43:48 -0400

On Friday, May 17, 2002, at 05:08 AM, Manfred Lippert wrote:

Hi,

I asked this question a few weeks ago, but got no answer.
I am still trying to implement an "autolocator" for an NSOutlineView, but I
had no success.

I want the user to be able to type some characters, and if there are no more
characters entered for a specific time, the NSOutlineView should "jump" to
the specific entry (whose entry begins with the entered characters).
Pretty the same way as the Finder does it (so there must be a way to do it).

How can I do that?

I tried to override "insertText" in my NSOutlineView subclass, but this is
never called.
keyDown is called, but insertText is never called.

Now I tried to allocate an (invisible) NSTextField object when the
NSOutlineView awakes from Nib and I hooked this NSTextField in the Responder
chain right after the NSOutlineView.
Result: NSTextField's keyDown is correctly called for all keys that are not
handled by NSOutlineView, but also insertText is never called. Entered
characters end in "beeps" just as they will without the NSTextField.

Please help!

How can I implement an autolocator in an NSOutlineView??

Sure, I could filter "printable" keys (a-z) directly in the keyDown method,
but this is a "hack" and then the autolocator will not work for special
characters that require more than one key stroke (French characters with
accent etc.). So it would be great if this works the "correct" way with help
of the text input manager.

I have run into the same problem. The best I've been able to do is subclass NSOutlineView, over-ride -keyDown, and make sure I'm not touching the "reserved" values. Check NSEvent.h for a list of Apple-reserved values. This works very well simply because NSOutlineView doesn't do anything with alphanumerics (no matter what language you're using), and it really doesn't matter what comes in since you're just trying to match it with the characters of the items of the NSOutlineView. You might also want to over-ride the arrow keys (these fall within the "reserved" section), but it's not hard to just pick these events out and leave the rest untouched.

However, this whole behavior seems very commonly needed, I wonder if you could file a bug report/feature request with Apple.

Brendan Younger
_______________________________________________
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.

  • Follow-Ups:
    • Re: insertText in NSOutlineView? (for Autolocator)
      • From: Manfred Lippert <email@hidden>
References: 
 >insertText in NSOutlineView? (for Autolocator) (From: Manfred Lippert <email@hidden>)

  • Prev by Date: Cocoa FAQ - Needs additions
  • Next by Date: about imageReps and images
  • Previous by thread: insertText in NSOutlineView? (for Autolocator)
  • Next by thread: Re: insertText in NSOutlineView? (for Autolocator)
  • Index(es):
    • Date
    • Thread