Just submitted Feedback Case #46463 WebControl Width with Left and Right Anchors Set Not Correct until WebPage is Resized.
I found this as I was placing WebContainer Controls onto a PDF. The width of the controls that had Locking Anchors set to Left and Right so the control could resize was not reporting its actual width.
- Create a new Web Project
- Add a WebLabel, WebTextField, or possibly other controls.
- Set the Locking Anchors to Top, Left, and Right so the control width will adjust to the WebPage width.
- Run the Project
- View the width of the controls in the browser with MsgBox or some other method and the Width will not be correct unless the browser WebPage is the same width as IDE WebPage width.
- Resize the WebPage and control width will be correct.
Attached is a project to demonstrate this problem.
- In the IDE, the Width of Label1 and TextField1 are 560.
- When the WebPage Opens and is Shown, the 'IDE width' is returned.
- If 'Check Width' is clicked before Resizing the Page, the 'IDE width' is returned.
- Resizing the Page returns the actual control width.
- If 'Check Width' is clicked after Resizing the Page, the actual control width is returned.
- Debugging and Compiled behave the same way.
Project Log where I ran the project and then make the browser width about 5 pixels wider.
BUTTON: WebPage1.Width = 1056 ; Label1.Width = 1016 ; TextField1.Width = 1016
RESIZED: WebPage1.Width = 1056 ; Label1.Width = 1016 ; TextField1.Width = 1016
BUTTON: WebPage1.Width = 600 ; Label1.Width = 560 ; TextField1.Width = 560
SHOWN: WebPage1.Width = 600 ; Label1.Width = 560 ; TextField1.Width = 560
OPEN: WebPage1.Width = 600 ; Label1.Width = 560 ; TextField1.Width = 560
Get the width of an anchored WebControl without resizing the WebPage
The width of the control in the browser is the IDE width until the page is resized.