문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top