Sign up

Showing the bottom text

I've got scroll windows with wrap, but want to know how to scroll to the bottom in the code.

Like as follows:

text.setCursor(text.getText.length);

Re: Showing the bottom text

On 03-06-2020 00:18, Joel Christensen wrote:

I've got scroll windows with wrap, but want to know how to scroll to the bottom in the code.

Like as follows:

text.setCursor(text.getText.length);

I believe you can scroll to the bottom using setHadjustment.

Re: Showing the bottom text

On Wed, 3 Jun 2020 23:19:59 +0200, Mike Wey wrote:

On 03-06-2020 00:18, Joel Christensen wrote:

I've got scroll windows with wrap, but want to know how to scroll to the bottom in the code.

Like as follows:

text.setCursor(text.getText.length);

I believe you can scroll to the bottom using setHadjustment.

I think it's setVadjustment, but I can't work it out without a code example - very little to go on. Would have to know the max height to set it to - says it's in pixels.

Re: Showing the bottom text

On 04-06-2020 02:06, Joel Christensen wrote:

On Wed, 3 Jun 2020 23:19:59 +0200, Mike Wey wrote:

On 03-06-2020 00:18, Joel Christensen wrote:

I've got scroll windows with wrap, but want to know how to scroll to the bottom in the code.

Like as follows:

text.setCursor(text.getText.length);

I believe you can scroll to the bottom using setHadjustment.

I think it's setVadjustment, but I can't work it out without a code example - very little to go on. Would have to know the max height to set it to - says it's in pixels.

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Re: Showing the bottom text

On Thu, 4 Jun 2020 19:46:03 +0200, Mike Wey wrote:

On 04-06-2020 02:06, Joel Christensen wrote:

On Wed, 3 Jun 2020 23:19:59 +0200, Mike Wey wrote:

On 03-06-2020 00:18, Joel Christensen wrote:

I've got scroll windows with wrap, but want to know how to scroll to the bottom in the code.

Like as follows:

text.setCursor(text.getText.length);

I believe you can scroll to the bottom using setHadjustment.

I think it's setVadjustment, but I can't work it out without a code example - very little to go on. Would have to know the max height to set it to - says it's in pixels.

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Your code works for smaller windows, but not for larger windows.

Re: Showing the bottom text

On Thu, 4 Jun 2020 19:46:03 +0200, Mike Wey wrote:

On 04-06-2020 02:06, Joel Christensen wrote:

On Wed, 3 Jun 2020 23:19:59 +0200, Mike Wey wrote:

On 03-06-2020 00:18, Joel Christensen wrote:

I've got scroll windows with wrap, but want to know how to scroll to the bottom in the code.

Like as follows:

text.setCursor(text.getText.length);

I believe you can scroll to the bottom using setHadjustment.

I think it's setVadjustment, but I can't work it out without a code example - very little to go on. Would have to know the max height to set it to - says it's in pixels.

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Actually, it doesn't work when text is wrapped, (not to do with the size of the window view).

Re: Showing the bottom text

On 05-06-2020 05:38, Joel Christensen wrote:

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Actually, it doesn't work when text is wrapped, (not to do with the size of the window view).

Strange, you would think the size of the textview would determine the
range of the scrollbar. And while the size of the textview changes
depending on if the text is warped or not that shouldn't matter to the
container it's in.

Re: Showing the bottom text

On Fri, 5 Jun 2020 22:33:38 +0200, Mike Wey wrote:

On 05-06-2020 05:38, Joel Christensen wrote:

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Actually, it doesn't work when text is wrapped, (not to do with the size of the window view).

Strange, you would think the size of the textview would determine the
range of the scrollbar. And while the size of the textview changes
depending on if the text is warped or not that shouldn't matter to the
container it's in.

Yeah, it just moves down a tiny bit. I don't think macOS is very well tested with. Let me know if you come up with anything more.

Re: Showing the bottom text

On Fri, 05 Jun 2020 23:53:40 GMT, Joel Christensen wrote:

On Fri, 5 Jun 2020 22:33:38 +0200, Mike Wey wrote:

On 05-06-2020 05:38, Joel Christensen wrote:

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Actually, it doesn't work when text is wrapped, (not to do with the size of the window view).

Strange, you would think the size of the textview would determine the
range of the scrollbar. And while the size of the textview changes
depending on if the text is warped or not that shouldn't matter to the
container it's in.

Yeah, it just moves down a tiny bit. I don't think macOS is very well tested with. Let me know if you come up with anything more.

I tried a 'TextView' object with no difference.

Re: Showing the bottom text

On Sat, 06 Jun 2020 04:53:35 GMT, Joel Christensen wrote:

On Fri, 05 Jun 2020 23:53:40 GMT, Joel Christensen wrote:

On Fri, 5 Jun 2020 22:33:38 +0200, Mike Wey wrote:

On 05-06-2020 05:38, Joel Christensen wrote:

You would probably do something like this:

Adjustment adj = scroledWindow.getVadjustment();
adj.setValue(adj.getUpper() - adj.getPageSize());
scrolledWindow.setVadjustment(adj);

To scroll to the bottom of the window.

Actually, it doesn't work when text is wrapped, (not to do with the size of the window view).

Strange, you would think the size of the textview would determine the
range of the scrollbar. And while the size of the textview changes
depending on if the text is warped or not that shouldn't matter to the
container it's in.

Yeah, it just moves down a tiny bit. I don't think macOS is very well tested with. Let me know if you come up with anything more.

I tried a 'TextView' object with no difference.

Actually, I found it sometimes does work, like it works for some things, but not others. Other things work some times. I think it's a timing issue - what can I do about that?