Center WebPage in Web App

Is it possible to have a web app page centered within the browser window the way a normal web page does? I have a single web page within my app that has an image and some text boxes but when i start the app it shows up at the far left of the page rather than the page content being centered.

I havent been able to find a way to do this.

To do this you should first create a WebContainer into which you put your WebControls.

Then, in the IDE, put your WebContainer at the center of your page and disable all the anchor lockers for this WebContainer.

Your WebContainer will now be perfectly centered, it will even center itself live on page resize.

Cheers,
Guy.

Guy, that works ok if you have one page but if you have lots of pages then you end up having to create separate contains and then drag the containers onto your pages, it makes it a bit messy whereas I had hoped you might be able to use something like the rectangle or be able to drop a frame of some sort onto the page and then drop you controls onto that so that the parent was the frame then you could in effect create groups of controls which would be more useful.

I understand what you mean, yes, like if we could drop the WebContainer directly onto the WebPage and put the WebControls directly ‘inside’ the WebContainer sitting in the WebPage. That would be nice for sure.

Although, on my side I don’t mind, this has became an habit to directly work on WebContainers then use them later on WebPages. The benefit of this is that you can think your pages with several containers you can show/hide/move dynamically depending on the user inputs, a change in the HashTag or another event, etc…

You mention having lots of pages, perhaps this is where you may have a different approach, I mean instead of having lots of pages the idea would be to have less pages which can change dynamically by rearranging your WebContainers inside on the fly. This is just another approach.

Cheers,
Guy.

I believe what Geoff is alluding to in this blog http://www.xojo.com/blog/en/2014/01/ios-progress-report.php will probably solve your problem.

But in the interim I have a single webpage with multiple containers that I make visible as required. Works ok on small sites, but probably doesn’t scale too well.

I think what Wayne is linking to goes some way to what is needed but it would still be very useful to be able to have a frame that you could drop controls on to in a page thus allowing you to move the frame around the screen and show / hide the frame and the controls within it with one command. In effect creating a group of controls within a page. Maybe this is something that MBS or one of the other plugin gurus might consider writing, any offers?

Hi,

Has the problem been resolved in any way, please?

I have the same issue: I want controls on my web pages to be centered (move left or right as page size change, but not be resized and stay in the same distance to each other).
I can do it through containers, as suggested above, but it is lots of additional work: after every change in the container, I have to remove the old one from the page, drop new one, and do some additional adjustments.
It would be great if:

  • either container changes would propagate to container instances on pages, or
  • I could put a container on a page and drop controls into it, or
  • there would be some kind of way to ‘glue’ controls together so they don’t move/resize relative to each other.

Thanks,
S.

Why do you think you have to remove/add the container each time?

Yes, you are right, I found that many changes are carried over from container to the page, but not all. For example, if you remove a control from the container, it is removed from an instance of the container on a page, but adding control to the container doesn’t add it to the page.
Controls sizes and positions are also not carried over to pages.

Are there any rules what is carried over and what not?

Thank you,
Stan

You may want to have a look at http://rubberviews.com/rubberviewswe.html which did not exist at the time this old thread was started.

[quote=323549:@Stan F]Yes, you are right, I found that many changes are carried over from container to the page, but not all. For example, if you remove a control from the container, it is removed from an instance of the container on a page, but adding control to the container doesn’t add it to the page.
Controls sizes and positions are also not carried over to pages.

Are there any rules what is carried over and what not?

Thank you,
Stan[/quote]
Actually they are. That’s just a refresh bug.

Michel, thank you. It looks great! (I think I’ll buy it.)

Greg, could you please elaborate? What is the workaround for this refresh bug?
For a new Xojo developer, it is difficult to distinguish between a bug and intended behavior.

Thanks in advance,
Stan

[quote=323627:@Stan F]Michel, thank you. It looks great! (I think I’ll buy it.)

Greg, could you please elaborate? What is the workaround for this refresh bug?
For a new Xojo developer, it is difficult to distinguish between a bug and intended behavior.

Thanks in advance,
Stan[/quote]
Often just opening another tab, but sometimes it requires reopening the project.

There’s a screen size bug in xojo web app.

It inconsistently provides different screen width upon opening the first webpage.

Try to monitor the screen width upon first webpage opening, then run it (again and again). It will show you inconsistent width.