brendand / mbtablegrid

An NSControl subclass which provides a spreadsheet-style table grid
9 stars 3 forks source link

Customize font, size, colour, and alignment properties per cell. #43

Open brendand opened 9 years ago

brendand commented 9 years ago

Add the ability to specify a different font, size, colour, and horizontal alignment of the text in each column. The ability to override at the cell level would be great too. That way for example, if you had a column of numeric values, you could have one or more cells display in red if the value was negative. The row height would have to adjust to accommodate taller fonts.

Dejal commented 9 years ago

Interesting. That probably wouldn't be too difficult, especially if the row height could remain fixed (i.e. adjust the height for all cells), though individual row-specific heights could be done with a bit more work (and some performance cost, like with table views).

brendand commented 9 years ago

Ya, that could be an issue (varying row heights within the same grid). But I think the component already can deal with that because I seem to remember seeing something about being able to manually change the height of a row by dragging up/down. Don't remember if that code was disabled or not.

Dejal commented 9 years ago

The -[MBTableGridContentView rectOfRow:] method has a fixed height of 20 pixels, though has some commented-out code to total the heights, which may be what you're thinking of -- but there isn't code to actually have separate heights there.

Anyway, manually sizable heights certainly could be done if you want it; it'd be basically the same logic as for sizable columns.

brendand commented 9 years ago

Ya, I don't want manually resizable rows. Automatic based on the content would be helpful. Although could get expensive. Certainly the regular heightForRowAtIndexPath would be helpful as I see it's not part of the protocol.