Re: Line Numbers in Tables
Re: Line Numbers in Tables
- Subject: Re: Line Numbers in Tables
- From: glenn andreas <email@hidden>
- Date: Wed, 29 Aug 2007 11:19:13 -0500
On Aug 29, 2007, at 11:07 AM, Gordon Apple wrote:
Simple function -- apparently no simple solution. I just want
to put
line numbers in one column of a table. I want them to start at "1"
and stop
at the last table entry. Nothing I've tried works and I've searched
available resources.
Tables are inside NSScrollViews. NSScrollViews can have rulers, and
rulers can be used for line numbers, so I'd look at tackling from
that approach.
Basically, make a subclass of NSTableView and a subclass of
NSRulerView (which communicates with the table view). In the table
view's awakeFromNib, create the ruleview and set the vertical ruler
of the table's enclosing scroll view to that. The ruler view would
call the table view's rowAtPoint to find the first visible row,
rectOfRow to figure out each row location (until it was off the ruler
view's visible rect).
This will give you the advantage that the line number is always
visible (and not scrolled away like a column would be).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures,
fractals, art
_______________________________________________
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