• 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: Getting data from NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting data from NSOutlineView


  • Subject: Re: Getting data from NSOutlineView
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 13 Dec 2005 13:33:50 +0000

On 13 Dec 2005, at 10:46, goessly wrote:

I'm looking for a way to access the values displayed in an NSOutlineViews cells programmatically.

... in order to retrieve data from this view I've attempted the following:

[outlineViewDelegate
objectValueForTableColumn: [outlineViewDelegate tableColumnWithIdentifier:@"titel"]
byItem: currentItem
];

with:
id currentItem = [outlineViewDelegate itemAtRow: itemCounter];

First of all, the compiler throws the following warning:
AppController.mm:302: warning: 'NSOutlineView' may not respond to '- objectValueForTableColumn:byItem:'

Strange enough, since NSOutlineView inherits this from NSTableView, doesn't it?

At runtime I get is this error message:

-[NSOutlineView objectValueForTableColumn:byItem:]: selector not recognized [self = 0x317410]

Any idea what's wrong? The outlineview is showing some core data managed objects, which I (seemingly) can't access directly, so I need to get the values from this Outlineview...

You're sending the messages to the wrong object(s). I suspect you have your outlineViewDelegate variable pointing at the outline view itself rather than the delegate, and also the example above is sending -tableColumnWithIdentifier: to the delegate rather than the outline view.

What you wanted was something more like

[[outlineView delegate]
tableView:outlineView
objectValueForTableColumn:[outlineView tableColumnWithIdentifier:@"titel"]
byItem:currentItem];

although generally speaking you should already have access to this information in a different way... after all, you provided the data in the first place, right? Accessing it through a method intended for use by the outline view itself doesn't seem like a very clean design, particularly as outline views are *views*, not places to store data (indeed, you will find, I think, that only *visible* data is available this way).

*Much* better to get the information from your *model* rather than trying to read it back from the view after it gets there.

Kind regards,

Alastair.

--
http://www.alastairs-place.net


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Getting data from NSOutlineView (From: goessly <email@hidden>)
 >Re: Getting data from NSOutlineView (From: goessly <email@hidden>)

  • Prev by Date: Re: NSMutableArray won't tell me its count !
  • Next by Date: Message cascading
  • Previous by thread: Re: Getting data from NSOutlineView [solved, kind of...]
  • Next by thread: Re: Getting data from NSOutlineView
  • Index(es):
    • Date
    • Thread