[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set-view-scroll-position & set-view-position



At  4:23 PM 11/15/93 +0000, Karsten Poeck wrote:
>#|
>Mcl 2.01 Quadra 700
>
>I have some troubles with the redrawing when I  move dialog-items in
>a view and call set-view-scroll-position afterwards. This can be best
>demonstrated
> by the follwing code. First call (create-window), wait and then call
> (create-bug #@(0 20)) both in the listener. The effekt is that Text 2 is
>shown
> both at the old and the new-position in the window. I assume that
>set-view-position tries to erase the old text2 
>view, but this is effectly executed after the scrolling is done.
> 
>Any clues? I tried some permutations of without-interrupts invalidate-view 
>and so on but had no luck

This is a bug with MCL's SET-VIEW-SCROLL-POSITION code. It scrolls
the bits but neglects to scroll the window-update-region and
window-invalidate-region (internal and mostly undocumented so don't
worry if you don't know about them). There are two ways around this:

(1) Force a redraw between set-view-position & set-view-scroll-position.
    The best way to do this is with (event-dispatch), but that won't
    work if your code runs in response to an event. In the latter case
    you'll have to say (window-update-event-handler (view-window scroller)).

(2) Ask me to send you "scroll-position-patch".

Neither method will get you exactly what you want in terms of the
best-looking scrolling. Method (1) will erase text2, then redraw it
20 pixels down, then scroll both text1 & text2 20 pixels up.
Method (2) will scroll both text1 & text2 20 pixels up, then erase
text2, then redraw it 20 pixels down. The ideal redisplay algorithm
would never erase text2, but simply scroll text1 20 pixels up. To
get this, you'll have to do it yourself by calling #_ScrollRect yourself,
calling set-view-scroll-position with NIL for scroll-visibly, and
adding appropriate validate-view and invalidate-region calls.