Bug 577566 - [Label] Label should request layout if the text changes
Summary: [Label] Label should request layout if the text changes
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.22   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-01 10:21 EST by Christoph Laeubrich CLA
Modified: 2021-12-01 10:21 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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