Recent

Author Topic: TTreeView scrolling  (Read 3700 times)

jcmontherock

  • Full Member
  • ***
  • Posts: 236
TTreeView scrolling
« on: January 08, 2018, 04:29:21 pm »
Is there a way to scroll a Treeview to show the selected item ?
"myTreeView.Selected.MakeVisible" and "myTreeView.Selected.Focused := true" have no effect and seems not to work. An automatic scrolling is done at half of the height and I cannot change this amount.
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

balazsszekely

  • Guest
Re: TTreeView scrolling
« Reply #1 on: January 08, 2018, 05:05:59 pm »
Hi jcmontherock,

Try:
Code: Pascal  [Select][+][-]
  1.  myTreeView.TopItem := myTreeView.Selected;

jcmontherock

  • Full Member
  • ***
  • Posts: 236
Re: TTreeView scrolling
« Reply #2 on: January 08, 2018, 05:47:38 pm »
Thanks GetMem. Unfortunately, it does not work better.
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

balazsszekely

  • Guest
Re: TTreeView scrolling
« Reply #3 on: January 08, 2018, 05:51:26 pm »
Please specify Lazarus/FPC version and  OS. Can you attach a demo example that demonstrates the issue? TTreeView.TopItem works as expected here.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TTreeView scrolling
« Reply #4 on: January 08, 2018, 09:23:07 pm »
Is there a way to scroll a Treeview to show the selected item ?
"myTreeView.Selected.MakeVisible" and "myTreeView.Selected.Focused := true" have no effect and seems not to work. An automatic scrolling is done at half of the height and I cannot change this amount.

Don't know if this can help you but when I have a TreeView with a lot of items, I usually search/scroll through it using the TTreeFilterEdit control. Since it implements incremental search, it reduces the number of items in the TreeView until it gets to an exact match. Then what is visible/highlighted in the TreeView is ultimately what will be selected by the user.

JD
« Last Edit: January 09, 2018, 02:49:57 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

jcmontherock

  • Full Member
  • ***
  • Posts: 236
Re: TTreeView scrolling
« Reply #5 on: January 09, 2018, 10:28:34 pm »
Lazarus 1.8.0, fpc 3.04, Windows 10 (64 bits), Laptop 13.3". I prepare a sample.
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

jcmontherock

  • Full Member
  • ***
  • Posts: 236
Re: TTreeView scrolling
« Reply #6 on: January 10, 2018, 02:58:21 pm »
I wrote a sample. I works !...  So I will investigate to see why it does not work with my app. Maybe it's coming from a package. Thanks to everybody.
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

jcmontherock

  • Full Member
  • ***
  • Posts: 236
Re: TTreeView scrolling
« Reply #7 on: January 10, 2018, 09:16:35 pm »
Finally I begin to understand: my laptop screen has an "applied DPI" of 144. In the project option at "Application params" the best result for window form and to have a Treeview scrolling ok, I have to set the LCL scaling and no use of manifest and "take in account DPI" desactivated. It's not the best view but it makes the TreeView working fine.
Thanks to everybody for suggestions.
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

 

TinyPortal © 2005-2018