Bug 577566

Summary: [Label] Label should request layout if the text changes
Product: [Eclipse Project] Platform Reporter: Christoph Laeubrich <laeubi>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.22   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=577140
Whiteboard:

Description Christoph Laeubrich CLA 2021-12-01 10:21:57 EST
This is one of the most annoying things that has bitten me to often so I'd open a bug for it now.

Given I construct a label and it is part of a control with layout, it keeps its *initial text size*.

For simplicity consider the label is empty by default, and changes e.g. by a button click, then it seems that the button has no effect as the label never changes (as its initial size is zero).

What works is doing the following:

label.setText(String.valueOf(sum));
label.requestLayout();

but this is really useless boilerplate, the label should simply be requesting the layout whenever its current text != new text (or simply always when setText is called, whatever is easier).

This is similar to Bug 577140