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 PROTECTED]> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/johnte%40mac.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to