itun
itun

Reputation: 3521

SWT Text set scroll value

In my application I have an SWT text field. I need to set a scroll value (roll the text in the field to the end in my case). How I can do that?

Upvotes: 0

Views: 1349

Answers (2)

Frettman
Frettman

Reputation: 2271

This should have the desired result without moving the cursor position:

text.setTopIndex(text.getLineCount() - 1);

Upvotes: 3

Edward Thomson
Edward Thomson

Reputation: 78643

You need to set the carat to that position, which will cause the text to scroll to that position. For example:

text.setSelection(text.getText().length());

Upvotes: 0

Related Questions