• 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: Attempting to create NSTableView with Single Header
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Attempting to create NSTableView with Single Header


  • Subject: Re: Attempting to create NSTableView with Single Header
  • From: John Terranova <email@hidden>
  • Date: Tue, 20 May 2008 23:36:06 -0700

3 steps to closely approximate what you want.

1) In IB, turn off column headers for the table.

2) Add this delegate method to the delegate object for the table:

- (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row
{
return row == 0; // the first row of the table will be treated as a "Group" row
}


3) You don't want to let the user select the "Group" row, so add this to your delegate:

- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow: (NSInteger)row
{
return row != 0: // don't allow selection of the first ("Group") row
}


Caveat: I have not compiled or tried this in real code. But, major downside to this that I can think of is that your pseudo header (the group row) will scroll out of view when the table scrolls. Can you live with that?

Ok, another option I just thought of. Turn off column headers and just place static text above the table view with your column header text.

	john


On May 20, 2008, at 10:46 PM, Brent Fulgham wrote:


On May 20, 2008, at 8:19 PM, Hamish Allan wrote:

On Wed, May 21, 2008 at 12:11 AM, Brent Fulgham <email@hidden> wrote:

|   My single column header |
|    Label 1 | Value 1            |
|    Label 2 | Value 2            |

Does anyone have any ideas for how to accomplish this?

How about using a single column, with a data cell that displays both your label and your value?

This would certainly work, but I was hoping to easily handle making the 'label' portion of the cell right-justified, and the 'value' portion left justified. This is trivial with a set of columns, but I'm not sure how to best deal with setting up the labels to have what amounts to left and right justified 'tab stops' so the data can appear properly formatted, especially if the user changes from a fixed-width font to something else.


Another possibility might be to do something like a custom NSCell that stores two values in specified-width regions, similar to existing examples for combination image and text fields.

-Brent

_______________________________________________

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

_______________________________________________

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: 
 >Attempting to create NSTableView with Single Header (From: "Brent Fulgham" <email@hidden>)
 >Re: Attempting to create NSTableView with Single Header (From: "Hamish Allan" <email@hidden>)
 >Re: Attempting to create NSTableView with Single Header (From: Brent Fulgham <email@hidden>)

  • Prev by Date: Re: Attempting to create NSTableView with Single Header
  • Next by Date: Re: Cocoa et al as HCI usability problem
  • Previous by thread: Re: Attempting to create NSTableView with Single Header
  • Next by thread: Safari-like padlock button in window title bar
  • Index(es):
    • Date
    • Thread