• 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: NSBrowser's current selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBrowser's current selection


  • Subject: Re: NSBrowser's current selection
  • From: Graham Cox <email@hidden>
  • Date: Tue, 21 Jul 2009 11:50:26 +1000


On 21/07/2009, at 11:28 AM, Chase Meadors wrote:

I'm using an NSBrowser with old-fashioned delegate methods. How can I be notified when the selection changes, and then get the correct object value for that row and column? Both NSBrowser delegate methods – browser:selectCellWithString:inColumn: and – browser:selectRow:inColumn: which the documentation states that "ask the delegate to select" never get called.

Are you certain the delegate is actually set? Do other delegate methods get called? How did you set the delegate?


How you determine the relevant object in your data model is up to you - you have row and column indexes, your controller has to convert that to some way of referencing the object. Most straightforwardly it can simply pass the index(es) to NSArray's -objectAtIndex: m ethod.


Then there's the -loadedCellAtRow:Column: method. The documentation states it "loads, if necessary, the cell and returns." Does this mean it calls
-browser:willDisplayCell:atRow:Column: to set the value before returning it?


That's my interpretation, yes, or at any rate, that's how the cell is given its content whenever necessary. But you must also implement either - (NSInteger)browser:(NSBrowser *)sender numberOfRowsInColumn: (NSInteger)column or - (void)browser:(NSBrowser *)sender createRowsForColumn:(NSInteger)column inMatrix:(NSMatrix *)matrix (but not both).

--Graham_______________________________________________

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: 
 >NSBrowser's current selection (From: Chase Meadors <email@hidden>)

  • Prev by Date: Best approach for selective spell-checking...
  • Next by Date: Re: Cocoa Graphics Parsing
  • Previous by thread: NSBrowser's current selection
  • Next by thread: Cocoa Graphics Parsing
  • Index(es):
    • Date
    • Thread