Recent

Author Topic: Setting TMemo.VertScrollBar.Position does not scroll the text field  (Read 19102 times)

balazsszekely

  • Guest
Re: Setting TMemo.VertScrollBar.Position does not scroll the text field
« Reply #15 on: November 25, 2015, 12:49:11 pm »
Quote
That's why I thought about a helper class. Maybe global functions could be used, too.
I did implement it today for windows and it's working fine. The content of the memo is scrolled nicely, but then I realized there is absolutely no reason to scroll the memo with a specific value. The point is the memo's scrollbar is set in a such way that you can only scroll it line by line. The amount it depends on the line's height. For example if the line height is 17px, it make no sense to scroll 24 px, because the scrollbar and the memo's content get out of sync. Probably this is the reason why in delphi the "manual" scrolling was removed.

Under lGTK2/ Carbon that's not true. The memo's scrollbar can take any value.
The bottom line is you cannot solve this issue with a helper class/global function. I'm afraid it has to be implemented separately in each widgetset.

PS: SendMessage/PostMessage works under linux too, but it has to be implemented a little bit differently. See examples-->messages-->project1.lpi
« Last Edit: November 25, 2015, 04:53:21 pm by GetMem »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: Setting TMemo.VertScrollBar.Position does not scroll the text field
« Reply #16 on: November 29, 2015, 08:29:39 pm »
I implemented TCustomMemo.ScrollBy together with fixing issue:
  http://bugs.freepascal.org/view.php?id=29067
See my comment there.

Now I need help to test the changes, especially the widgetsets I could not test myself.

Somehow I missed the last comment from GetMem, sorry.
GetMem, what do you think of my solution for Windows? At least Memo.ScrollBy does something now. Earlier it did nothing.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

balazsszekely

  • Guest
Re: Setting TMemo.VertScrollBar.Position does not scroll the text field
« Reply #17 on: November 29, 2015, 08:32:06 pm »
Quote
Now I need help to test the changes, especially the widgetsets I could not test myself.
It's not scrolling on windows. You should combine WM_HSCROLL with SB_LEFT/SB_RIGHT and VM_VSCROLL with SB_LINEDOWN/SB_LINEUP. Another solution would be EM_LINESCROLL(see henrik response: http://forum.lazarus.freepascal.org/index.php/topic,30468.msg193957.html#msg193957). Tested with this and it's working fine.

Quote
GetMem, what do you think of my solution for Windows? At least Memo.ScrollBy does something now. Earlier it did nothing.
I agree, it's much better now then without scrolling, although in windows it' s a little bit confusing, the following code:
Code: Pascal  [Select][+][-]
  1. Memo1.VertScrollBar.Postion := Memo1.VertScrollBar.Postion + 1;
Will change the position with 17 or so.
« Last Edit: November 29, 2015, 09:55:21 pm by GetMem »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: Setting TMemo.VertScrollBar.Position does not scroll the text field
« Reply #18 on: November 29, 2015, 10:08:20 pm »
It's not scrolling on windows.

I applied a new patch from Ondrej in r50525. Please test again.

Quote
I agree, it's much better now then without scrolling, although in windows it' s a little bit confusing, the following code:
Code: Pascal  [Select][+][-]
  1. Memo1.VertScrollBar.Postion := Memo1.VertScrollBar.Postion + 1;
Will change the position with 17 or so.

How to improve it?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

balazsszekely

  • Guest
Re: Setting TMemo.VertScrollBar.Position does not scroll the text field
« Reply #19 on: November 29, 2015, 10:23:31 pm »
Quote
I applied a new patch from Ondrej in r50525. Please test again.
It works now.

Quote
How to improve it?
I have no idea what would be the ideal solution. Anyway it's a great improvment. Thanks Juha!

 

TinyPortal © 2005-2018