See this thread for discussions on determining a string’s width.
To align labels at a bottom value, you only need a simple calculation to determine the correct top position: - . To make it easier to use, you could create a method in a module that extends WebControl so that it applies to all controls:
Sub SetBottom(extends wc as WebControl, bottom as integer)
If wc <> nil Then
wc.Top = bottom - wc.Height
You would then call .SetBottom on every control that you wanted aligned.
I guess I will need to wait for some of the iterations to use the auto layout discussed in that other link. These are dynamic labels where the label is a fixed width and variable height, depending on need. So I need to know the height of what the text will be so that I can make the label the appropriate height and multiline if necessary. And then with that information I can use your above suggestion to determine a bottom alignment.
At present Auto Layout does not take into account the content of controls. And from what I see it may not be exactly simple to implement.
On desktop, you would use Graphics.Stringwidth and Graphics.Stringheight to know the dimensions of a particular block of text. Problem is, even if Web Edition supports that and you can use it in a debug run on your computer, most hosts do not have fonts installed. See https://forum.xojo.com/15834-install-fonts-on-linux-server
If you can get your host to install fonts for you, or if you can install them yourself on your VPS, then it becomes available to estimate precisely the size of the text.