~eliasnaur/gio#34: 
Give a way for layout.List{Invert:true} lists to behave like Invert=false when scrolled

See thread for context.

Status
RESOLVED FIXED
Submitter
~theclapp
Assigned to
No-one
Submitted
9 months ago
Updated
6 months ago
Labels
No labels applied.

~theclapp 9 months ago

Standalone demo in https://lists.sr.ht/~eliasnaur/gio/<20190830140250.GA33016%40larrymbp14>/raw .

~eliasnaur REPORTED FIXED 9 months ago

Very thorough reproducer program, thanks. Fixed in gioui.org/commit/1529f20.

~theclapp 9 months ago

Thanks and thanks! :)

Is there any way to programatically scroll a list? Say if I had two lists but if you scrolled one I wanted the other one to stay in sync? It looks like List.offset records the scroll amount, but of course a user can't read it or write to it, and that's probably not the interface you'd want anyway. (Just curious; I don't have a real use-case for this at the moment.)

~eliasnaur 9 months ago

On Thu Sep 5, 2019 at 7:44 PM ~theclapp wrote:

Thanks and thanks! :)

Is there any way to programatically scroll a list? Say if I had two lists but if you scrolled one I wanted the other one to stay in sync? It looks like List.offset records the scroll amount, but of course a user can't read it or write to it, and that's probably not the interface you'd want anyway. (Just curious; I don't have a real use-case for this at the moment.)

There isn't yet a way to access the scroll offset. It's definitely a useful feature, but just like you I haven't had a use for it yet.

One complication is that the offset field is not absolute, but rather relative to the first visible element to avoid traversing the entire underlying list at every layout.

-- elias

~theclapp 6 months ago

Is there any way to programatically scroll a list? ...

I've developed a use-case for this. :)

I think, for me, it'd be sufficient to be able to a) get the index of the top item on the list, and b) set that index as the top item of the same list, at a later time. Basically I display a list, scroll it, display another list, go back to the previous list, and I'd like to display it at the same spot it was before.

... As I wrote that I realized I could conceivably just display a new list on top of the old one, or create a new list object, display it, and then swap the old one back in again.

So I'll give that a shot.

That said, this approach will not apply to every situation (and might not work for me!), so being able to programmatically move or scroll a list will still come in handy eventually.

~theclapp 6 months ago

So I'll give that a shot.

I gave that a shot, and it did work ... and it also got me started down the road to https://lists.sr.ht/~eliasnaur/gio-patches/patches/9145, layout: make List scroll position settable.

Register here or Log in to comment, or comment via email.