I have a UI with a TWebLabel
that is right-aligned. The Caption
is dynamically set for the label.
When the page is loaded and the Caption
is set, then the label doesn't fit in:
But as soon as I resize the page, then it fixes itself:
So it's almost as if it doesn't know that the Caption
changed and doesn't know that it needs to increase the label's width. It only realizes once I resize the page and then it fixes the UI for the new dynamic content.
So how can I trigger or invoke the onResize
of the TWebForm
so that the page thinks that it resized?
One of the solutions is to invoke it using JavaScript through the
ASM
code block:Using the above code will trigger the form's
onResize
event and will fix the Label's issue also.