D6 ScrollingDecorator bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

D6 ScrollingDecorator bug

Steve Alan Waring
Hi,

I think there is a bug in ScrollingDecorator when both the horizontal
and vertical bars are displayed. To see the bug, follow these steps:

 - Open a browser and switch to the Class Diagram plugin.
 - Select a class like AXTypeInfoObject which has a few subclasses.
 - Make the Class Diagram window narrow enough so that both scroll bars
appear.
 - Try scrolling the vertical scroll bar down.

I am unable to scroll to the bottom. It looks like it scrolls down, but
then jumps back up.

A possible fix is below ... what I found is the vertical scroll does
take place, but is reversed when the complete view re-layout takes
place. I think this is caused when the layoutContext, for the complete
view re-layout, is asked for #clientExtentOf:. The position is already
present in the layout, so it asks the view for
#calcClientRectangleFromRectangle:. This uses the result from
#calcRectangleFromClientRectangle:, however the MSDN docs for
AdjustWindowRect say that it does not take into account the WS_VSCROLL
or WS_HSCROLL styles.

A possible fix is:

!ScrollingDecorator methodsFor!

calcRectangleFromClientRectangle: aRectangle
        "Adjust the result for the scrollbars as per:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/adjustwindowrect.asp?frame=true."

        | unadjusted isShowingHScroll isShowingVScroll |
        unadjusted := super calcRectangleFromClientRectangle: aRectangle.
        "< ? .... msdn: not show if 'page size that includes the entire scroll
range' "
        isShowingHScroll := (self getScrollPage: SB_HORZ) < self
horizontalRange size.
        isShowingVScroll := (self getScrollPage: SB_VERT) < self verticalRange
size.
        ^unadjusted expandBy: (Point zero
                                corner: (isShowingVScroll ifTrue: [SystemMetrics current
scrollbarWidth] ifFalse: [0])
                                                @ (isShowingHScroll ifTrue: [SystemMetrics current
nonClientMetrics iScrollHeight] ifFalse: [0])).! !

Thanks,
Steve


Reply | Threaded
Open this post in threaded view
|

Re: D6 ScrollingDecorator bug

Jochen Riekhof-6
Hi Steve...

thank you for this fix! I also have this ugly behavior. Will try your
fix soon.

Ciao

...Jochen


Reply | Threaded
Open this post in threaded view
|

Re: D6 ScrollingDecorator bug

Jochen Riekhof-6
Hi Steve...

just tried it out, works fantastic. The whole behavior of scrolling my
app now looks perfect.

Thanks again!

Ciao

...Jochen