Pergunta

I have a SWT button (with SWT.CHECK flag) and SWT Text. Upon pressed, SWT button should enable/disable the wrapping of the SWT text.

I am aware that text wrapping capability is specified in the constructor as follow:

new Text(parent, SWT.WRAP)

But I couldn't find a method such as setWrap(false) to programmatically enable/disable it in runtime.

Is there a way to do this in SWT? Or the only solution is to dispose the old text, and create a new one with different flag?

Foi útil?

Solução

In general SWT styles can't be changed and this is the case for the Wrap style of the Text control.

The StyledText control does have a setWordWrap(boolean) method, you should be able to use that.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top