• 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: NSTableView row counter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView row counter


  • Subject: Re: NSTableView row counter
  • From: Moray Taylor <email@hidden>
  • Date: Sun, 15 Feb 2004 17:23:26 +0000

This sounds good, I had a quick go, but didn't get very far, I have an outlet to the TableView, and it's already subclassed for other reasons, so this method would fit well.

How would I draw the row counter in the NSView, I suppose I would need to get the position of the scrollbar or something?

The reason I wanted to use an NSRulerView is that it *almost* does exactly what I need, the synchronized scrolling is already taken care of.

If anyone has any examples of this type of thing, I'd love to see it. The program I am writing is Cocoa/Java, but Obj-C code is just as welcome.

Thanks

Moray

How about simply putting an NSView subclass next to an NSTableView? If you have an outlet to the table view you could get information (such as the row height). The problem is you don't know when to redraw this view. One way would be to subclass NSTableView as well and tell the NSView subclass to redraw every time the table is redrawn.

This way is very hack-ish, but it should work. If you are developing a framework that other programmers will use you will want to think of something better. The right way to do this would be to subclass NSTableView and implement the row headers similar to the column headers, but I think you would need to know more about NSTableView than the documents provide in order to accomplish this.

Ryan


On Feb 15, 2004, at 6:00 AM, Moray Taylor wrote:

Hi,

I am currently investigating ways to put a row counter onto my NSTableView, like a spreadsheet. I can't just use the first column, as it disappears when I scroll horizontally.

I was thinking of using a NSRulerView, as it does everything I need it to do, apart from the numbers are in the wrong places, and just don't look the way I want them to. Should I overide the drawRect:, or am I barking up the wrong tree?

The line counter in XCode's text editor is almost what I want, how is that done?

Thanks v much

Moray
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSTableView row counter
      • From: Ryan Bates <email@hidden>
References: 
 >NSTableView row counter (From: Moray Taylor <email@hidden>)
 >Re: NSTableView row counter (From: Ryan Bates <email@hidden>)

  • Prev by Date: Re: NSTableView row counter
  • Next by Date: Re: What to do with a bad nib?
  • Previous by thread: Re: NSTableView row counter
  • Next by thread: Re: NSTableView row counter
  • Index(es):
    • Date
    • Thread