Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

I bet the human brain is a kludge. -- Marvin Minsky


programming / comp.lang.smalltalk.dolphin / Rapidbly updating scrollbar size

SubjectAuthor
* Rapidbly updating scrollbar sizeJoe Betz
`* Re: Rapidbly updating scrollbar sizeZenchess
 `- Re: Rapidbly updating scrollbar sizeJoe Betz

1
Subject: Rapidbly updating scrollbar size
From: Joe Betz
Newsgroups: comp.lang.smalltalk.dolphin
Date: Tue, 22 Feb 2022 20:15 UTC
X-Received: by 2002:a1c:c907:0:b0:37b:f983:5d4e with SMTP id f7-20020a1cc907000000b0037bf9835d4emr4642479wmb.174.1645560960005;
Tue, 22 Feb 2022 12:16:00 -0800 (PST)
X-Received: by 2002:a4a:1b43:0:b0:31b:aa93:dd7d with SMTP id
64-20020a4a1b43000000b0031baa93dd7dmr8162316oop.68.1645560959109; Tue, 22 Feb
2022 12:15:59 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.88.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Tue, 22 Feb 2022 12:15:58 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=5.48.59.174; posting-account=P1X3VgoAAADgSty0b3mKYJl_KPjmW842
NNTP-Posting-Host: 5.48.59.174
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6858ac67-c269-457d-ac97-6455f44157f2n@googlegroups.com>
Subject: Rapidbly updating scrollbar size
From: joebet...@gmail.com (Joe Betz)
Injection-Date: Tue, 22 Feb 2022 20:15:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
View all headers
What is the correct way to ensure that a scrollbar is updated when the content it manages changes size at a fast rate?

I'm using a GdiplusDoubleBufferedView inside of a ScrollingDecorator to render a list of 100+ items. Whenever a new item gets added, I call `self invalidate` to rerender the list. However, the scrollbar doesn't seem to be getting updated accordingly. The only thing that seems to work is adding a call to `creationParent layout`, but that results in the list flickering with each item added.

I see a couple solutions:
- set up a debouncer to ensure that layout isn't recalculated with every item added, e.g., only after 100ms have passed since last item added
- batch up items upstream to reduce layout recalculation

But neither seem ideal.
 
Are there any better ways to handle this situation?


Subject: Re: Rapidbly updating scrollbar size
From: Zenchess
Newsgroups: comp.lang.smalltalk.dolphin
Date: Wed, 23 Feb 2022 04:13 UTC
References: 1
X-Received: by 2002:adf:a4d7:0:b0:1ed:b579:eac7 with SMTP id h23-20020adfa4d7000000b001edb579eac7mr523623wrb.623.1645589624388;
Tue, 22 Feb 2022 20:13:44 -0800 (PST)
X-Received: by 2002:a4a:b08b:0:b0:2e2:c1b5:fcc6 with SMTP id
k11-20020a4ab08b000000b002e2c1b5fcc6mr8527762oon.51.1645589623838; Tue, 22
Feb 2022 20:13:43 -0800 (PST)
Path: i2pn2.org!i2pn.org!news.swapon.de!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.128.88.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Tue, 22 Feb 2022 20:13:43 -0800 (PST)
In-Reply-To: <6858ac67-c269-457d-ac97-6455f44157f2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=75.163.81.11; posting-account=r2EEkwoAAADz3M0x3Szspui4wqseZF5h
NNTP-Posting-Host: 75.163.81.11
References: <6858ac67-c269-457d-ac97-6455f44157f2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aea6cbdb-16fc-4973-88b0-60a958188c5fn@googlegroups.com>
Subject: Re: Rapidbly updating scrollbar size
From: zench...@gmail.com (Zenchess)
Injection-Date: Wed, 23 Feb 2022 04:13:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
View all headers
I don't know how your situation works, but I was using 'self invalidate' to update my chessboard program, and what I had to eventually do was only redraw the nearby squares instead of the entire repaint.  Don't know if that can help you but I thought I'd just throw that out there


Subject: Re: Rapidbly updating scrollbar size
From: Joe Betz
Newsgroups: comp.lang.smalltalk.dolphin
Date: Fri, 25 Feb 2022 03:00 UTC
References: 1 2
X-Received: by 2002:a05:622a:1044:b0:2de:2db0:3c01 with SMTP id f4-20020a05622a104400b002de2db03c01mr5306130qte.365.1645758047687;
Thu, 24 Feb 2022 19:00:47 -0800 (PST)
X-Received: by 2002:a05:6870:b211:b0:d6:defc:ff27 with SMTP id
a17-20020a056870b21100b000d6defcff27mr519985oam.100.1645758047224; Thu, 24
Feb 2022 19:00:47 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Thu, 24 Feb 2022 19:00:46 -0800 (PST)
In-Reply-To: <aea6cbdb-16fc-4973-88b0-60a958188c5fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.48.59.174; posting-account=P1X3VgoAAADgSty0b3mKYJl_KPjmW842
NNTP-Posting-Host: 5.48.59.174
References: <6858ac67-c269-457d-ac97-6455f44157f2n@googlegroups.com> <aea6cbdb-16fc-4973-88b0-60a958188c5fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b8667469-7e32-4b2a-ac2c-fe0a4a9b2cd6n@googlegroups.com>
Subject: Re: Rapidbly updating scrollbar size
From: joebet...@gmail.com (Joe Betz)
Injection-Date: Fri, 25 Feb 2022 03:00:47 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 35
View all headers
Okay, think I figured it out. Calling `creationParent layout` was doing way more work than necessary, so I extracted the logic for updating the scrollbar into a separate function and am now only calling that instead.

VirtualScrollingDecorator>>updateScrollbar
| layoutContext newScroll scrolled clientExtent desiredExtent viewExtent |
layoutContext := LayoutContext forContainer: self.
scrolled := self firstSubView.
clientExtent := layoutContext clientExtentOf: self.
desiredExtent := scrolled layoutExtent: layoutContext.
viewExtent := clientExtent max: desiredExtent.
newScroll := ((scrollOffset x min: viewExtent x - clientExtent x) max: 0)
@ ((scrollOffset y min: viewExtent y - clientExtent y) max: 0).
layoutContext setView: scrolled rectangle: (scrollOffset negated extent: viewExtent).
self scrollOffset: newScroll context: layoutContext.
self updateScrollBars: layoutContext

There was still a case of the content flickering whenever I scrolled to a newly added item to the list (as opposed to immediately when it's added), but I was able to find a similar solution there by overriding the `wmPaint:wParam:lParam` method to skip the call to `self ensureLayoutValid`. I think this is okay since the layout of everything inside the GDI+ canvas is handled by my custom list widget class.

I don't know how your situation works, but I was using 'self invalidate' to update my chessboard program, and what I had to eventually do was only redraw the nearby squares instead of the entire repaint. Don't know if that can help you but I thought I'd just throw that out there

Were you using GdiplusDoubleBufferedView or was the chessboard created with MVP components?

I don't think there is a way to redraw subregions of a GDI+ canvas, nor would it be desirable since it already implements double buffering.


1
rocksolid light 0.7.2
clearneti2ptor