RE: Scrolling a text cell in an NSTableView subclass...
RE: Scrolling a text cell in an NSTableView subclass...
- Subject: RE: Scrolling a text cell in an NSTableView subclass...
- From: Keith Blount <email@hidden>
- Date: Thu, 17 Feb 2005 06:17:31 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Sorry to reply to my own post, but I'm really
struggling with this... I thought I might be able to
solve it with a combination of NSTextField's setWraps:
and setScrollable:, but neither have any effect.
If anybody has any ideas, I would be really grateful.
Many thanks again,
Keith
---- Original message: ----
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!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
_______________________________________________
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