Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > TableView: stringValue of an item???

TableView: stringValue of an item???
Thread Tools
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 2, 2002, 06:41 PM
 
OK, I have a TABLE and I can select row. Fine.

But what I need is to get the stringValue of the item in the a given COLUMN of the selected row.

What should I do?

Get an array and turn it into a string? or something?
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Sep 2, 2002, 06:50 PM
 
Well, you already know how your table view is displying text - that's because you implemented tableView:objectValueForTableColumn:row: in your delegate, right? Then you can just send this message to your delegate with the appropriate tableView instance, tableColumn instance, and row index (found by calling NSTableView's selectedRow method, although it's slightly more involved if more than one row can be selected), and it will return the object value. That is, what you see is what you get.

There's other ways - I usually write a custom method that does virtually the same thing as tableView:objectValue..., but it only accepts a couple parameters, like the tableView, the column identifier, and the row index.

Does that make sense?
Matt Fahrenbacher
     
VEGAN  (op)
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 2, 2002, 06:58 PM
 
Originally posted by Ghoser777:
Well, you already know how your table view is displying text - that's because you implemented tableView:objectValueForTableColumn:row: in your delegate, right? Then you can just send this message to your delegate with the appropriate tableView instance, tableColumn instance, and row index (found by calling NSTableView's selectedRow method, although it's slightly more involved if more than one row can be selected), and it will return the object value. That is, what you see is what you get.

There's other ways - I usually write a custom method that does virtually the same thing as tableView:objectValue..., but it only accepts a couple parameters, like the tableView, the column identifier, and the row index.

Does that make sense?
Matt Fahrenbacher
Hmmm... it almost(*) makes sense. Let me try it out.

I've never completely understood what the heck is the "objectValueForTableColumn"?? Is it the column's identifier? Or..?

(*) It's veeeeeeeery late where I am so this makes it harder for me
(Last edited by VEGAN; Sep 2, 2002 at 07:15 PM. )
     
VEGAN  (op)
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 2, 2002, 07:24 PM
 
THANX I GOT IT
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:44 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2