• 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
Which element was selected in completion pull-down?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Which element was selected in completion pull-down?


  • Subject: Which element was selected in completion pull-down?
  • From: email@hidden
  • Date: Tue, 2 Oct 2007 20:43:48 -0700

Hello list.

I'm now getting the expected completion behavior for my Safari-style address field (thanks to Stephen Butler's advice), but now I need to determine which element (if any) in the completion pull-down was selected when the field's action is sent.

The completion pull-down is an NSWindow with a table view that uses an undocumented table model class according to F-Script. The completion pull-down window appears to a child window of the window that contains the address field.

The field's action is sent on enter, so I'd like to be able to determine at that time which object (if any) was selected in the completion pull-down. I can think of a couple approaches, but am not sure how to implement either one. Here are the two alternatives I can think of:

* Provide the objects to the pull-down and provide a formatter to select the proper string for display in the menu. If this is a good approach, how do I provide the formatter to the pull-down model? I don't know how to get a reference to the pull-down during completion. How do I determine which item was selected? Is it the object of some notification I can get?

* Remember the result of the query that populates the pull-down. When the action is invoked on enter, get the index of the selected item (if any), then grab the object at the same index. In this case, I don't know how to get the index of the selected item, or how to get a reference to the pull-down in order to establish a listener. Does the pull-down post notifications?

I have checked the docs for NSTextView, NSControl and their respective superclasses for hints, and can't see any obvious delegate methods or mention of notifications.

Any advice is most welcome. Thanks.

_______________________________________________

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


  • Prev by Date: Re: How can we draw a NSWindow in a custom NSView?
  • Next by Date: Upgrading an XCode 1 (pre Intel) project to XCode 3 on an Intel Imac
  • Previous by thread: Re: Mapping ABPerson to Sync Services
  • Next by thread: Upgrading an XCode 1 (pre Intel) project to XCode 3 on an Intel Imac
  • Index(es):
    • Date
    • Thread