From: Stefan Csomor Date: Thu, 29 Nov 2007 08:28:12 +0000 (+0000) Subject: porting forward scrolling fix X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c4807c0a8fdce8c8a21f7296cc224c08297ca54b porting forward scrolling fix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50321 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 5cbb3089a0..f97f8da6b6 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -1878,9 +1878,18 @@ void wxMacDataItemBrowserControl::MacScrollTo( unsigned int n ) GetScrollPosition( &top , &left ) ; wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n ); + // there is a bug in RevealItem that leads to situations + // in large lists, where the item does not get scrolled + // into sight, so we do a pre-scroll if necessary UInt16 height ; GetRowHeight( (DataBrowserItemID) item , &height ) ; - SetScrollPosition( n * ((UInt32)height) , left ) ; + UInt32 linetop = n * ((UInt32) height ); + UInt32 linebottom = linetop + height; + Rect rect ; + GetRect( &rect ); + + if ( linetop < top || linebottom > (top + rect.bottom - rect.top ) ) + SetScrollPosition( wxMax( n-2, 0 ) * ((UInt32)height) , left ) ; RevealItem( item , kDataBrowserRevealWithoutSelecting ); }