[Prev][Next][Index][Thread]
Re: Using DUIM's <viewport>
In article <wku2hxaofu.fsf@double.co.nz>, Chris Double
<chris@double.co.nz> wrote:
> Dustin Voss <agent_@mindspring.com> writes:
>
> > Can you (or anyone) think of a way to automatically repaint this?
> > Maybe hook into some event somewhere?
>
> If you don't mind a bit of flicker when scrolling, adding the
> following method will do the trick:
>
> -----------------8<-----------------
> define method note-viewport-position-changed(
> frame :: <scroll-test-frame>,
> sheet :: <sheet>, x, y) => ()
> next-method();
>
> let region = frame.lists-pane.sheet-region;
> with-sheet-medium (medium = sheet)
> clear-box*(medium, region)
> end;
> repaint-sheet(sheet, region);
>
> do-sheet-children(update-gadget, frame.lists-pane);
> end;
> -----------------8<-----------------
>
> The method note-viewport-position-changed gets called when the
> scrolling area is scrolled. It is called by scroll-viewport-child. It
> looks like the redraw problem is somewhere in scroll-viewport-child or
> something it calls. The method above erases the list panes and then
> forces them to update again after scroll-viewport-child is called.
>
> It is specialised on the frame so you'll have to add this method for
> each frame where you do this sort of thing.
>
> Hope that helps,
> Chris.
That seems to work fine (aside from the flicker) for list boxes. I had
intended to use list controls, though, and this technique doesn't work
for that. I poked around in the source code, but couldn't figure out
what was different.
Interestingly, if I do this (IIRC)...
define method note-position-changed (frame :: <frame>, sheet :: <sheet>)
next-method();
sheet.sheet-mapped? := #f;
sheet.sheet-mapped? := #t;
end;
...it works correctly for list controls as well as list boxes. But it
still flickers, and the control loses focus -- I tried to save and reset
the focus to no avail.
I dug through the DUIM source and tried to find why this works. My best
guess is that relayout-parent or relayout-children is responsible, but I
called those functions manually and the controls didn't repaint properly.
I think I'll try to make my own control. Wish me luck! -- I'm sure I'll
need it.
Thanks for everyone's help!
References: