• 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: Line Numbers in Tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Line Numbers in Tables (From: Gordon Apple <email@hidden>)

  • Prev by Date: Line Numbers in Tables
  • Next by Date: Re: Line Numbers in Tables
  • Previous by thread: Line Numbers in Tables
  • Next by thread: Re: Line Numbers in Tables
  • Index(es):
    • Date
    • Thread