Change WebControlWrapper height to match lines of text

Hello,

I am programming a page to display html text on a WebControlWrapper. When the amount of text is longer than the WebControlWrapper the vertical scroll bars do not appear. If the WebControlWrapper height is changed (by guessing or by making some crude height spacing algorithm) then the vertical scroll bar appears and I am able to scroll through the text.

Is there an easier way to determine the end of the page of HTML text and have the WebControlWrapper height adjust to the end of the HTML text?

Here is an example which shows text but does not adjust the WebControlHeight. Example 7-1

Thanks :slight_smile:

You certainly could, but keep in mind that users have a certain expectation that the control will be contained in the space they define in the IDE. if you make your control do something different, it may be very hard to control.

[quote=221081:@Eugene Dakin]Hello,

I am programming a page to display html text on a WebControlWrapper. When the amount of text is longer than the WebControlWrapper the vertical scroll bars do not appear. If the WebControlWrapper height is changed (by guessing or by making some crude height spacing algorithm) then the vertical scroll bar appears and I am able to scroll through the text.

Is there an easier way to determine the end of the page of HTML text and have the WebControlWrapper height adjust to the end of the HTML text?

Here is an example which shows text but does not adjust the WebControlHeight. Example 7-1

Thanks :)[/quote]

I would encapsulate that inside a WebContainer, which will provide the scrolling.

Also, have you set the overflow-y css property?

overflow-y: scroll

That was it.

Sub SetupCSS(ByRef Styles() as WebControlCSS) Styles(0).Value("visibility") = "visible" Styles(0).Value("overflow-y") = "scroll" End Sub

Thank you Greg :slight_smile:

Michel and Greg,

Thank you! It works great.

overflow-y: scroll

I tried the above code in a

tag and it didn’t work, and as Michel mentioned the code needed to be in SetupCSS - which works.

[quote=221366:@Eugene Dakin]Michel and Greg,

Thank you! It works great.

overflow-y: scroll

I tried the above code in a

tag and it didn’t work, and as Michel mentioned the code needed to be in SetupCSS - which works.[/quote]
Sorry. That was meant as an indication of the CSS you needed, not as raw code to put somewhere in html.

Its all good. Thanks for the clarification Greg.

but what about the situation where you have “list” of items and each item in the list can be a different height depending on its content?

For an example, look at the web page you are currently reading. Each forum entry can be a different size and they all resize to their content and slide up against each other.

HTML will normally handle this without any problems but I can’t see how to do it with Xojo…

[quote=221930:@Steve Upton]but what about the situation where you have “list” of items and each item in the list can be a different height depending on its content?

For an example, look at the web page you are currently reading. Each forum entry can be a different size and they all resize to their content and slide up against each other.

HTML will normally handle this without any problems but I can’t see how to do it with Xojo…[/quote]

Precisely, using CSS makes it work flawlessly…

Do you mean in Xojo? If so can you expand on that?

I can see placing elements in a list but they have a static position. Even if we alter their CSS to allow them to grow to accommodate their contents, the other elements in the list won’t move up/down…

[quote=221945:@Steve Upton]Do you mean in Xojo? If so can you expand on that?

I can see placing elements in a list but they have a static position. Even if we alter their CSS to allow them to grow to accommodate their contents, the other elements in the list won’t move up/down…[/quote]

What you seem to overlook is precisely that Xojo Web undelying structure is CSS and JavaScript. A WebSDK Control wrapper allows using one single CSS property to have a whole block of text scroll, no matter the height of lines. It is a way to obtain results in Xojo web not unlike what declares do for Desktop. It may not be Xojo code, it is a way to tap into the framework from Xojo.

I get that Xojo Web is based on web technologies. And having written javascript/CSS/HTML - based dynamic web sites for the past 15 years or so, I’m familiar with what they can do.

It’s the boundaries between Xojo and non-Xojo that I’m exploring.

Yes I can create a control that is entirely of my own making. But then I’m giving up on many of the benefits of Xojo within that control. If I want a list that contains containers, and the containers can contain Xojo controls, database field contents, etc. then it gets tough. The benefits of Xojo I want to take advantage of are the OOP design efficiencies and also the layout ease.

The challenge is dealing with varying amounts of text content, just as the OP for this thread was asking about.

Yes, I can dump them into a container that can scroll. But what if I want to lay out something like this forum? I can get the whole page to scroll, but I don’t want to scroll the contents of each post within a fixed size box. I want each post to grow to accommodate it’s text. And I want each post to slide down to accommodate the one above.

[quote=221966:@Steve Upton]I get that Xojo Web is based on web technologies. And having written javascript/CSS/HTML - based dynamic web sites for the past 15 years or so, I’m familiar with what they can do.

It’s the boundaries between Xojo and non-Xojo that I’m exploring.[/quote]

You will not reach the boundaries of Xojo until you fully devote yourself to it. Then when you get to the limits of Xojo, you will very well see how to apply your 15 years of experience in javascript/CSS/HTML to go even further.

That is a completely different proposition than this thread. Rather than hijacking it, may I suggest you start your own thread ?

[quote=221974:@Michel Bujardet]You will not reach the boundaries of Xojo until you fully devote yourself to it. Then when you get to the limits of Xojo, you will very well see how to apply your 15 years of experience in javascript/CSS/HTML to go even further.
[/quote]
?

I’ve been programming in RealBasic / Xojo since 1999… is that what you mean?

I’m really just looking for information regarding the finer points of Xojo / web behavior in order to solve a particular problem.

[quote=221974:@Michel Bujardet]
That is a completely different proposition than this thread. Rather than hijacking it, may I suggest you start your own thread ?[/quote]

I’d like to but I tried with this topic and got no response whatsoever (some weeks ago). Once I saw this related thread today I thought I’d re-try the question.

The challenge I’m faced with is I haven’t heard that what I want to do is impossible or not.

Since you mention it, follow-up in https://forum.xojo.com/24954-natural-web-control-sizing