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 > padding cells in an nstableview with whitespace

padding cells in an nstableview with whitespace
Thread Tools
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Dec 4, 2002, 12:23 AM
 
Im trying to figure out how provide a pad of whitespace in nstableview cells ala iTunes. My latest idea was to write a formatter which added a space at the front and back of each cells contents. Imagine my chagrin when I found that NSFormatters drop leading and trailing spaces when returning the formatted cell. Is there some esoteric key sequence I can use to put something at the front and back of my format string, that will not show up in the table cell, yet will still be there in the cell so that nsformatter wont drop it off? Does this make any sense? For instance ive tried these chars to pad my formatter with no joy. space, option space, shifted space. These are all summarily lopped off by the tableView. Is my only recourse to "subclass" NSCell? I put that in quotes, because subclassing is something im a hack at best at. It took me a week to subclass NSSplitView to snap shut/open on double click. I really feel like there must be some invisible char which i can put into my NSFormatter that it wont lop off. As a matter of fact, who exactly _is_ lopping of my spaces? NSTableView? NSFormatter? Im guessing its the NSCell. I dunno... At this point I suppose Im just rambling.

Any help with this would be much appreciated.
3R1C
     
Senior User
Join Date: Mar 2000
Location: Ithaca, NY
Status: Offline
Reply With Quote
Dec 4, 2002, 05:24 PM
 
Subclassing NSCell is probably the easiest way to go about this. There is a good example of how to implement this in /Developer/Examples/AppKit/DragNDropOutlineView. Take a look specifically at the awakeFromNib method in the AppController, where the setup is done, and the ImageAndTextCell subclass which performs the custom drawing. What you want to do is really very similar to this, except that you want a blank space instead of an image in the cell.
     
   
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 06:25 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