Strategies for dynamic height and/or infinite scrolling?

Hi everyone!,

I’ve been playing a lot lately with Xojo’s Web 2. As I’ve mentioned in another post, surely there are glitches and a lot of room for improvement, but overall is starting to be really nice. I especially like using custom cell renderers, not sure if they were there in the previous version, but kudos.

The thing is, as a web developer, I’m trying to push the limits of it a bit further, and convince other colleagues and friends Xojo could replace nowadays Frankenstein’s web stacks.

There is something I’m struggling to replicate with Xojo, which is showing a list of dynamic height components like, for example, Twitter web version, or just a quick Google search results clone. It’s pretty common in web apps.

As Xojo places everything with fixed positioning (which is nice most of the time, no complains), it feels like going against current when trying to use the proposed Flex option. I could surely do CSS/JS sorcery, but I would like to know if there is a better Xojo-way to create these kind of layouts.

Hope you have a nice week, thanks.

a container controll have a property scroll direction, so if you use there .EmbedWithin
this can be scrolled or scrollbars appear.
see WebContainer.EmbedWithin examples.

Thank you @MarkusR, I don’t want the control to be scrollable itself, but the whole page instead. So what I’ve end up doing is setting up an empty container with this code in the Opening event:

LayoutType = LayoutTypes.Flex
LayoutDirection = LayoutDirections.TopToBottom

Style.Value("gap") = "15px"
Style.Value("height") = "auto"

That does the trick, more or less. The WebGrid example is also helpful.

Thanks again!

1 Like

I’m way less an expert than you about the web part of Xojo, so I’m just wondering: can’t you just increase the height of the web page?

Yes @Arnaud_N, the only thing is you will then have to be watching constantly the height of each control, to see if any of their height changed. That’s something the browser can do for us easier.

Ah, so you’re modifying existing controls, not adding new ones at the end of the page (I presume). Makes sense.
Thanks.

1 Like

Personally, as a user, I find this to be extremely irritating. Scrollbars are supposed to give an idea of how much content there is, not lie to you and suddenly change.

2 Likes

It depends, with a Twitter-like service you know that you will never be able to reach the very first tweet, no matter how much you scroll. Infinite scroll is a commonly established pattern in web apps (this forum, for example uses it).

How much we can personally hate it won’t change the fact you may receive this as a project requisite.

Just to clarify, isn’t like I want to defend infinite scrolling, I just want check if I can say “yeah, you can do that with Xojo as well” (without being a pain, of course).

So true.
“New” additions are not always good, carefully designed.

As we say in french, the friends of my enemies are my enemies too :wink:
Social networks didn’t need to be created in the first place; they were and I presume infinite scrolling came from there, because of their design.

Correct. Not everything is bright, but a bright-only world would burn eyes…

1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.