Reputation: 6079
Is it possible to alter the style bits of SWT controls after initialization? I know I can pass them to the constructor, but I wonder if I can also change them after having called the constructor. I know that I can do so for the layout-related information, but how about bits such as SWT.READ_ONLY
on a combo box for example?
Is there anything such as (imaginary code):
Combo cmbExample = new Combo(s, SWT.NONE);
// ...
cmbExample.setStyleBit(SWT.READ_ONLY);
Upvotes: 1
Views: 56
Reputation: 111216
No, the style bits are fixed and cannot be changed.
One reason for this is that the SWT implementation for a platform may actually create completely different native controls depending on the style.
For example on macOS the read only Combo
uses NSPopUpButton
whereas the read write Combo
uses NSComboBox
.
There is the occasional exception - StyledText
has setEditable
which overrides the SWT.READ_ONLY
style, but most controls don't do this.
Upvotes: 3