How to resize webcontainer during runtime?

Hello all,

I have a generic web container that holds a webgrid and some other controls. I start the webcontainer with a minimum size and would like to resize it during runtime when the webgrid it contains is populated. The webgrid will resize fine, but I cannot figure out how to get the container to resize. Instead I get scroll bars which in this case are not really desirable.

The only way I saw that the container will pay attention to a new size is in a shown event. Is that true? If so how do I call the page, to then re-raise the containers shown even? If anyone has a recommendation I would sure appreciate it!


How do you instanciate the WebContainer ?

Hi Michel,
I have tried both placing at designtime as well as using embeddwithin.

My RubberViewsWE resizes WebContainers at any time.

So I wonder why it does not seem to work with your code.

This works perfectly in a button, for instance :

Sub Action() Handles Action dim myheight as integer = ContainerControl11.height * 1.1 ContainerControl11.height = myheight End Sub

Would you post the code you have tried ?

You might have to create a timer that gets started in the shown event to then size your web containers appropriately. We’ve had a bunch of dynamically created sizing issues so you’re not alone.

In one project we gave up and put all of the containers on the webpage (so they were static and invisible) and then resized them and switched visibility on the fly. There is something inherently flawed with Xojo webpages returning incorrect dimensions.

Actually, the first resize returns usually the design size, and then it is alright.

Note that even in JavaScript, it is never perfect.

It’s been a few releases since this project but we literally could never resize our dynamic web containers properly because we never got the right size. If memory serves the width wasn’t too bad but the height was never right.

I was talking about webPage, mainly, but as it happens, browsers don’t report page height correctly when a page is scrollable. Even in JavaScript. In RubberViewsWE I had do do a lot of song and dance to get it right.

There is another thing, is that there is often a discrepancy between dimensions set in Xojo, and the actual size of the control in the DOM. Never huge, but there.

Hi Guys and thanks for the responses.
I will try doing some of the things your mentioned. The only thing with the timer is then the objects will flash, at least once. But maybe there is something that can be done with that too.

I agree with the page size problem. I saw you both write about it in this thread

I came across the problem about a week ago when adding Christians ChartDirector. The pie wont work with the click since until it gets new/correct page sizes. I found that the reported page size was wrong until a page resize was done - manually. I saw from that thread you use javascript to get the correct size Michel. Eventually I will get back to that too.

Thank you both again!

The timer idea worked really well Bob.
That plus Michel’s resize code example did the trick(s).

Thanks again guys!

This resize thing is giving me headaches too! :slight_smile:

I prepared a document describing what happens when I try to resize my containers… The size of the sheet Webdialog is OK but the container inside just can’t adjust… Could someone tell me what to do?

I enclose to links. One to a HTML doc illustrating my difficulties and the second is the demo I used to make de document. Of course, feel free to download…

Link to Document

Link to DemoApp Project


I get 404 not found on both your links.

Oups! Let me check that…

Here are 2 new links that should work better

Link to Document

Demo WebApp
Link to Demo App Project

Webdialogs apart from Palette report size incorrectly as the size of the window.

I had to work hard for RubberViewsWE to work around that one.

Use Palette instead, or check my class at where you can download an evaluation project.

Thanks Michel,

I tried switching to a palette instead but it doesn’t solve my issue. Containers get the right size but the controls inside it that are locked at the bottom still don’t resize and keep their original size.

It is a one year old project that used to show fine. I don’t remember having issues with that.

screen shot


Thanks Michel, the palette plus some new code lines finally made it work.

I would like to leave a comment about all the energy it required me to get it right. My comment is not targeting anyone personally. I also want to thank everyone here sharing their solutions and thoughts. That is just fantastic and very different from many other working environments I’ve been working in. We also love to work with Xojo, it has been a relief when we started with this platform 3 years ago.

I just need to share my thoughts about the hours spent finding a suitable solution to a simple situation that, as far as I’m concerned, shouldn’t have been problematic. I understand that it may be quite difficult to deal with JavaScript but …

Such a basic functionality (I refer to control position and resizing for exemple) should be available and working out of the box. I’ve spent to much time figuring a way to make it work. It is totally counterproductive and frustrating…

Even if we buy the Pro Licence, we never make the desktop projects. People want Web Apps, they want their applications to be accessible from anywhere, for multiple users, in couple of different languages and most of them don’t want to bother with server maintenance, licensing… So I wish there would be more improvement on the tools we have to develop Web applications since I think it deserves more care and attention.

With all my respect.

Obviously if it was easy to fix it would have been done by now. There are some things in the web framework that weren’t thought out very well way back when it designed.

I know Greg has talked about a rewrite of the web framework but I have no idea what status its in. I suspect we might find out more next week at XDC.

Thanks Mr Bikini for your feedback. :slight_smile: As I said, I had no intention of being unpleasant, just stressing out that Web Development is very popular (am I wrong?) and being efficient is of great importance.

As a very small business owner, these little things can become very frustrating. We often use “personal time” or time that should be dedicated to other business tasks (business development is one of them) when things go wrong. At the end it not good for me neither for Xojo team.

Nevertheless, I appreciate a lot Xojo as a platform and as a community as well. Hopefully we’ll be able to improve the web framework in the near future!