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 > NSTableHeaderCell

NSTableHeaderCell
Thread Tools
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Oct 2, 2002, 02:34 AM
 
Does anyone know how I would coax an NSTableHeaderCell to draw itself with a blue/graphite appearance (as if it were the selected column in a table view)?

No combination of setState, setHighlighted nor setEnabled seems to change the appearance the way I want.

Thanks,
Dave
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Oct 2, 2002, 02:18 PM
 
Use -highlightWithFrame:inView: instead of -drawWithFrame:inView:, IIRC.
Rick Roe
icons.cx | weblog
     
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Oct 4, 2002, 05:38 AM
 
Im thinking I dont understand the question 'cuz the following works for me:


[tableView setHighlightedTableColumn: tableColumn];
     
Porfiry  (op)
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Oct 5, 2002, 01:04 AM
 
3R1C, I'm trying to use the NSHeaderCell on its own, not part of any NSTableView in particular.

Rickster, your suggestion didn't seem to work. As far as I can tell, highlightWithFrame seems to produce the result as drawWithFrame.

Anyways, it's not essential, but it'd be nice to crack this nut.
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Oct 5, 2002, 08:00 PM
 
Maybe -highlight:withFrame:inView: ?

(inherited from NSCell, but it seems to be overridden in NSTableHeaderCell)
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Oct 6, 2002, 12:57 AM
 
Ah, posted the wrong method signature from memory since I didn't have the code handy. Here's the correct version, straight from a view I wrote recently that does exactly what you're talking about:

Code:
if ([[self window] isKeyWindow]) [cell highlight:YES withFrame:cellRect inView:self]; else [cell drawWithFrame:cellRect inView:self];
Also, it'll only work if the current graphics context (i.e. the view you locked focus on) actually belongs to the current key window -- it won't work drawing into a cached NSImage, for example.
Rick Roe
icons.cx | weblog
     
   
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:52 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