Scrolling a text cell in an NSTableView subclass...
Scrolling a text cell in an NSTableView subclass...
- Subject: Scrolling a text cell in an NSTableView subclass...
- From: Keith Blount <email@hidden>
- Date: Wed, 16 Feb 2005 16:28:48 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
I have an NSTableView subclass that allows for
variable row heights depending on the text entered
(based on Evan Jones' RowResizableTableView,
http://www.eng.uwaterloo.ca/~ejones/).
I currently have this problem: if any of the row's
edges are outside of the viewable area in the
scrollview and the user moves the cursor or types
outside of the viewable area, the table view does not
automatically scroll to make the selection visible.
As a rough workaround for now, I put the following
text in textDidChange: in NSTableView:
NSRect scrollRect = [self
frameOfCellAtColumn:editedColumn row:editedRow];
scrollRect.origin.y += scrollRect.size.height;
scrollRect.size.width = 0;
scrollRect.size.height = 0;
[self scrollRectToVisible: scrollRect];
But this only handles the case of if the user is
typing and the text goes off the bottom of the view -
then the cell table view gets scrolled up. It doesn't
handle the cases of if the user types off to the
right, or moves the cursor up above the visible area,
for instance.
Has anybody got any ideas of how I could go about
fixing this? Essentially I just need to work out the
curren NSPoint at which the insertion point is placed
so that I can do a scrollToPoint: - though even this
may be a little ungraceful. There are no delegate
methods that tell me the selection has changed and no
information with which to use scrollRangeToVisible: as
far as I can see...
Many thanks in advance to anybody who has any
suggestions.
All the best,
Keith
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden