Embedwithin top/left does not work

dynamic creation of containercontrol and their positioning on the page: if the controls are created dynamically (“embedwithin”) during the opening or show events of the webpage in which they will be created, they are positioned without respecting the top and left positions indicated in embedwithin, I think it was already a case reported with fedback case 61210 are there any news?

Greg said there:

The behavior described in case 61210 is not a bug. One must set the left and top locks.

Var cc As New ContainerControl1
cc.LockLeft = True
cc.LockTop = true
cc.EmbedWithin(Self, 0, 0, 103, 103)
1 Like

have you tried to insert this code in the show or opening event of the webpage and giving left and top (in embedwithin) values ​​other than zero?

This example does seem to work:

1 Like

now I’m not in front of my pc,

but if I remember correctly… the xojo example adds the controls through the code contained in a webbutton and I am referring to the behavior of the code that dynamically adds controls that is executed in the SHOW or opening event of the webpage .

Well as @Rick_Araujo says it does work, in MainPage.Shown:

If mDateContainers(0) Is Nil Then
  Var dc As New DateContainer
  dc.LockLeft = True
  dc.LockTop = True
  dc.EmbedWithin(Self, AddContainer1Button.Left + AddContainer1Button.Width + 100, AddContainer1Button.Top, 270, 54)
  
  mDateContainers(0) = dc
End If

i see no issue… you NEED to change “me” to “AddContainer1Button” or some other button…

1 Like

What version of Xojo are you using?

Just did this with 2021r3 and is working correctly:

I opened a case to make LockLeft and LockTop default to True so no need to add it for most cases of what users want, if someone needs that lock to be False, they can add the code to do it instead of always needing to set it to True. That will make code created for Desktop to be similar to Web (on desktop we don’t need to LockLeft/LockTop).

1 Like

ok, my mistake, my (ported) code lacked the .lockleft and .locktop, inserted these works.
my mistake

thank you all

old code :…

dim y as Integer
dim i as Integer
y=20
for i=0 to 20
dim c as new cCC
c.EmbedWithin(self,5,y,c.Width,c.Height)
y=y+c.Height+1
next i