I have this function :
public static void changeState(Text control,final int style)
{
if (SWT.ENABLED == (style & SWT.ENABLED)) {
MyService.setState(control, SWT.ENABLED);
}
if (SWT.DISABLED == (style & SWT.DISABLED)) {
MyService.setState(control, SWT.DISABLED);
}
if(SWT.READ_ONLY == (style & SWT.READ_ONLY)){
MyService.setState(control, SWT.READ_ONLY);
}
}
I want to clear the current state of the widget before setting another state to it.
I made a text object for which I set the state to inactive and after this I tried to set it to read_only but it didn't work and that's why I am trying to make a function which clears the current state in order to be able to change states for the same object.
How should I do this?
Maybe there is some function which does this but I couldn't find one.
There are no such flags as SWT.ENABLED
or SWT.DISABLED
.
You enable/disable a control using
control.setEnabled(boolean);
You change the read only state of a Text
control using
control.setEditable(boolean);
Note that most other style bits cannot be changed once a control has been created.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.