Composite container = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(container); Label label = new Label(container, SWT.BORDER); label.setText("TRUNCATED LONG PIECE OF TEXT:"); label.pack(); GridDataFactory.swtDefaults().hint(label.getSize().x, SWT.DEFAULT).applyTo(label);
Hi Marcel,
the common workaround is to add a resize listener to the widget and do
your logic there. When widget is created, its bounds are estimated,
based on text size estimation. With the next request from the client (it
happens automatically if there are text for measuring) the layout will
be triggered and the widget bounds will be automatically adjusted to the
real text size. No need to reload the application.
Best,
Ivan
On 10/19/2013 3:00 AM, M Küng wrote:
> Hi Ivan,
>
> Thanks for the quick response. That does indeed explain why it's
> happening but it doesn't explain how to work around the issue.
>
> It there an elegant way to force the re-layout to happen without
> requiring the user to refresh the page in the browser?
>
> I tried calling layout(true, true) on the parent Composite but that
> doesn't work and I can see that the TSD code is simply returning the
> last value it cached rather then updating the cached value.
>
> Thanks,
>
> Marcel