Re: NS*View and Scrolling
Re: NS*View and Scrolling
- Subject: Re: NS*View and Scrolling
- From: Rick Bischoff <email@hidden>
- Date: Fri, 23 Jul 2004 10:23:07 -0500
Hi,
The link you provided works for the text view-- however, it is not the
solution to the table view. Another response I got from Matt Neuburg
provided the solution for the tableview: rowsInRect!
Here is my final coded solution for the table view for the archives:
int index = [table selectedRow];
/* See if the currently selected row is visible. */
BOOL isVisible = NO;
NSRange visible = [table rowsInRect:[[table superview]
documentVisibleRect]];
if ( index >= visible.location && index < (visible.location +
visible.length) )
isVisible = YES;
Assuming, of course, that your table is enclosed in a ClipView, this
will work fine.
Thanks all,
Rick Bischoff
On Jul 23, 2004, at 10:07 AM, Public Look wrote:
>
See http://cocoa.mamasam.com/MACOSXDEV/2003/04/2/62126.php
>
>
There are several other posts about this in the same archived thread
>
and others. I almost think this is a FAQ.
>
>
On Jul 23, 2004, at 6:50 AM, Rick Bischoff wrote:
>
>
> Hello,
>
>
>
> I have two problems in my current app that are very similar.
>
>
>
> 1. I have an NSTextView that is continuously being updated with data
>
> (think telnet client). When the data comes in, I append it to the
>
> text view and scroll it to visible. This is acceptable behavior IF
>
> and only IF the user is already scrolled all the way to the bottom;
>
> How do I tell if the user has scrolled the view up?
>
>
>
> 2. I have an NSTableView that is continuously being updated with data
>
> (I have no analogy here, sorry). When new rows are added or delete
>
> (in sorted order, so they could be added above or below), I maintain
>
> the user selected row and scroll it to visible-- this is also
>
> acceptable behavior.. The problem is when the user has a selected row
>
> and then scrolls the table to look at other rows. When data comes
>
> in, it automatically scrolls the table back so his original selected
>
> row is visible.
>
>
>
> These are both VERY annoying usability wise. So, is there a way to
>
> tell if
>
>
>
> 1. In the case of NSTextView, the last text of the view is visible
>
> AND/OR if the scroll bar is not at it's vertical extreme?
>
> 2. In the case of NSTableView, the currently selected row is visible?
>
>
>
> Thanks,
>
> Rick Bischoff
>
> _______________________________________________
>
> 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.