Bug in Re-positioning Controls after WebDialog Resized?

I have some controls and a WebLabel in a WebDialog. In design time, the height of the WebDialog is 645, and the top of the WebLabel is 603 (which is close to the bottom part of the dialog)

In the Resized event of the WebDialog, I put the code: WebLabel.top = self.Height - 22 // (645 - 603 = 22)

However, when the WebDialog is resized, it doesn’t behave the way I expected, it is beyond the the bottom part of the WebDialog. Am I doing it wrongly?

There is a bug where the label width and height are improperly reported as the width and height of the browser window.

Sheet and modal dialogs are affected. Palette dialog is not.

I am use Palette.

Double check in the inspector that the type is not sheet or modal. What you describe is typical.

Sub Resized() Handles Resized label1.Top = (self.height-label1.height)/2 label1.left = (self.width-label1.width)/2 End Sub

Checked. Its Plaette.

Then lock a 1x1 pixels empty label to the bottom, and another to the right of the palette. That will give you the correct width and height. Useful to work around the sheet and modal bug.

However, here, I obtain the very same value with this in a Palette :

system.debuglog str(self.width)+" "+str(label3.left+1) system.debuglog str(self.height)+" "+str(label2.top+1)

Thanks Michel.

[quote=323550:@Tony Lam]I have some controls and a WebLabel in a WebDialog. In design time, the height of the WebDialog is 645, and the top of the WebLabel is 603 (which is close to the bottom part of the dialog)

In the Resized event of the WebDialog, I put the code: WebLabel.top = self.Height - 22 // (645 - 603 = 22)

However, when the WebDialog is resized, it doesn’t behave the way I expected, it is beyond the the bottom part of the WebDialog. Am I doing it wrongly?[/quote]
Tony, why don’t you just set the bottom lock?

Yes! How stupid am I

Hmm, yeah, well, but Tony’s approach should still work right? Nothing stupid about it, as far as I can see.

In my experiments with a Palette dialog, it works. I don’t know why it does not work for Tony.