From the old version of xojo, I usually do this code to center container control in web page.
dim c as New cc_login
Dim h As Integer = ( Self.Height - c.Height ) /2
Dim varLeft As Integer = (Self.Width - c.Width) /2
c.EmbedWithin(Self, varLeft , h, c.width , c.Height)
With Web2.0, container control is position at the lower right part of the webpage.
How to center webcontainer?
drag it in the middle of the page until you see a blue crosshair behind it
it is then centered without the need of any code.
Thanks Jean,
But I need to do this with code because customer had different screen sizes, and I also use multiple webcontainer on a single page.
Any other idea?
with the method I described, it is centered on any screen size.
1 Like
Yeah, it works!
Does this mean, there is no more way to make it dynamic just like I did it via code?
AlbertoD
(AlbertoD)
6
Can you post a sample project? I can’t reproduce the problem so I may be missing something.
I think you’re having the same issue I’m having with Xojo using percentages, instead of pixels:
<https://xojo.com/issue/61543>
You can achieve it like this:
c.LockTop = True
c.LockLeft = True
Then embed it.
1 Like
Hi Ricardo,
Your suggestion works!!! Thank you!
c.LockTop = True
c.LockLeft = True
1 Like