Recent

Author Topic: [ SOLVED ] Difference between tvirtualstringtree and ttreview  (Read 4472 times)

superc

  • Full Member
  • ***
  • Posts: 241
Hello,

what is the difference between tvirtualstringtree  and ttreeview?
In which cases is it better to use one or the other?

Thanks in advance.
« Last Edit: July 22, 2021, 09:44:46 am by superc »

yus

  • Jr. Member
  • **
  • Posts: 57
Re: Difference between tvirtualstringtree and ttreview
« Reply #1 on: July 21, 2021, 11:10:12 am »
TVirtualStringTree the best component, stores references to custom data structures, provides high performance and flexibility in displaying data.
I recommend using TVirtualStringTree

balazsszekely

  • Guest
Re: Difference between tvirtualstringtree and ttreview
« Reply #2 on: July 21, 2021, 11:12:41 am »
Hello,

what is the difference between tvirtualstringtree  and ttreeview?
In which cases is it better to use one or the other?

Thanks in advance.
TVirtualStringTree is basically a TTreeView on steroids. That doesn't necessary mean it's better in every situation, it all depends on what are you trying to achieve. The learning curve for VST is much steeper, that's for sure.
So the question is what are you after? What are the requirements?

superc

  • Full Member
  • ***
  • Posts: 241
Re: Difference between tvirtualstringtree and ttreview
« Reply #3 on: July 21, 2021, 11:20:57 am »
I have to basically visualize the result of a query with two levels of depth, the total of lines could be more than 1000 lines, each node must display approximately 4 fields.

Now the problem is mostly understanding how it works

balazsszekely

  • Guest
Re: Difference between tvirtualstringtree and ttreview
« Reply #4 on: July 21, 2021, 11:27:15 am »
I have to basically visualize the result of a query with two levels of depth, the total of lines could be more than 1000 lines, each node must display approximately 4 fields.

Now the problem is mostly understanding how it works
So you need at least 4 columns for the fields? Then go with VST.
What database engine do you use? IIRC I did a few years ago a demo project(firebird table-->VST) for a forum user. Let me see if I can find it.

Edit: Corrected typo.
« Last Edit: July 21, 2021, 09:15:26 pm by GetMem »

superc

  • Full Member
  • ***
  • Posts: 241
Re: Difference between tvirtualstringtree and ttreview
« Reply #5 on: July 21, 2021, 11:29:15 am »
Zeoslib for connection and sqlite and postgres for db data ( the program could recover data from both db)

balazsszekely

  • Guest
Re: Difference between tvirtualstringtree and ttreview
« Reply #6 on: July 21, 2021, 11:39:45 am »
Zeoslib for connection and sqlite and postgres for db data ( the program could recover data from both db)

Then unfortunately my demo project is no use for you. One more question: in the returned query, the level of depths how are represented? With a ParentID?

ID    ParentID  F1  F2 F3
1      -1             x    x   x   //rootnode because ParentID= -1
2       1             x    x   x   //childnode to ID = 1

superc

  • Full Member
  • ***
  • Posts: 241
Re: Difference between tvirtualstringtree and ttreview
« Reply #7 on: July 21, 2021, 11:46:51 am »
For the moment no, but I can modify the query for this result,  I am editing the source code of a program not made by me

balazsszekely

  • Guest
Re: Difference between tvirtualstringtree and ttreview
« Reply #8 on: July 21, 2021, 11:56:33 am »
I will make a small demo later with sqlite. What is your lazarus/fpc/zeos/sqlite version?
« Last Edit: July 21, 2021, 11:58:45 am by GetMem »

superc

  • Full Member
  • ***
  • Posts: 241
Re: Difference between tvirtualstringtree and ttreview
« Reply #9 on: July 21, 2021, 11:58:05 am »
Thank you, you are very kind : lazarus 2.0.12 fpc 3.2.0, zeos 7.2, sqlite 3; target platform windows i386
« Last Edit: July 21, 2021, 12:12:21 pm by superc »

balazsszekely

  • Guest
Re: Difference between tvirtualstringtree and ttreview
« Reply #10 on: July 21, 2021, 02:56:08 pm »
@superc

I did the demo project with:  Lazarus 2.0.12 (32 bit),  FPC 3.2.0, Zeos 7.2.14, VST shipped with Lazarus.
All you have to do is unpack the attached zip, then copy sqlite3.dll(32 bit) to the project folder.
Few notes:
  - the different levels are linked with ParentID(-1 for root). For more detail see table "Food".
  - you can add as many levels as you like, just make sure you sort the sql by ParentID(asc), before populating the tree(see qFood.SQL)
  - I implemented some font/background coloring, sorting by column click

PS: Feel free to ask questions if you like.

superc

  • Full Member
  • ***
  • Posts: 241
Re: Difference between tvirtualstringtree and ttreview
« Reply #11 on: July 21, 2021, 04:57:16 pm »

as soon as possible I will try the code and let you know, thank you very much  :D :D

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Difference between tvirtualstringtree and ttreview
« Reply #12 on: July 21, 2021, 05:11:47 pm »
what is the difference between tvirtualstringtree  and ttreeview?
I normally use the standard TTreeView because
- it comes with Lazarus
- it is maintained by the Lazarus team
- it is sufficient for small to medium-large trees

I switch to VirtualTreeView when
- there are many (millions) of records
- the records are stored somewhere and I do not want, or cannot afford, to store them a second time in the tree
- I need columns like in a stringgrid

Starting with Laz v2.0 the virtualtreeviews package comes with Lazarus and is maintained by the Lazarus devs, too. Note that this is an out-dated version (v5.5.2) while the official development is at v7 or so. But I never needed anything from the newer versions. Nevertheless, starting with Laz v.2.2 the internal virtualtreeview has been renamed so that a newer version can be installed in parallel to the built-in version if needed.

superc

  • Full Member
  • ***
  • Posts: 241
Re: Difference between tvirtualstringtree and ttreview
« Reply #13 on: July 22, 2021, 09:44:30 am »
@superc

I did the demo project with:  Lazarus 2.0.12 (32 bit),  FPC 3.2.0, Zeos 7.2.14, VST shipped with Lazarus.
All you have to do is unpack the attached zip, then copy sqlite3.dll(32 bit) to the project folder.
Few notes:
  - the different levels are linked with ParentID(-1 for root). For more detail see table "Food".
  - you can add as many levels as you like, just make sure you sort the sql by ParentID(asc), before populating the tree(see qFood.SQL)
  - I implemented some font/background coloring, sorting by column click

PS: Feel free to ask questions if you like.


It works very well, now I try to modify the query to render the result with the fields already ready for the representation of the nodes, thank you again.




 

TinyPortal © 2005-2018