Recent

Author Topic: VirtualTreeView MultiLine Cpomponents  (Read 2964 times)

balazsszekely

  • Guest
Re: VirtualTreeView MultiLine Cpomponents
« Reply #15 on: April 07, 2021, 04:56:33 pm »
It turned out that VST is much smarter then I thought. :) See attached project.

PS: Just resize the form once the tree is loaded.

Weitentaaal

  • Hero Member
  • *****
  • Posts: 503
  • Weitental is a very beautiful garbage depot.
Re: VirtualTreeView MultiLine Cpomponents
« Reply #16 on: April 07, 2021, 05:31:58 pm »
I Will have a look at it tomorrow ... Thank u very Much  :)
Lazarus: 2.0.12 x86_64-win64-win32/win64
Compiler Version: 3.2.2

Weitentaaal

  • Hero Member
  • *****
  • Posts: 503
  • Weitental is a very beautiful garbage depot.
Re: VirtualTreeView MultiLine Cpomponents
« Reply #17 on: April 08, 2021, 10:23:28 am »
Yo don't know what i did but after i implemented the LisFill out of my SQlite DB it worked with Multiline, didn't had to trim the String.

Here my Function to write into StringTree :

Code: Pascal  [Select][+][-]
  1. Procedure AddChilds(var Recordset: TSQLQuery; Root : PVirtualNode; VST : TVirtualStringTree; Regelungsart : String);
  2. var
  3.    Node : PVirtualNode;
  4.    Data : PTreeData;
  5.    Query : TSQLQuery;
  6. begin
  7.   Query := TSQLQuery.Create(NIl);
  8.  
  9.   //Childs
  10.   dbExecute(Query, 'SELECT * FROM RegelungAuswahl WHERE '+Regelungsart+' = 1 and IsChild = 1 and ChildOF = '''+Recordset.FieldByName('ID').AsString+''' ORDER BY Ordnen ');
  11.   While not Query.EOF do begin
  12.      dbExecute(dbSprachen, 'SELECT * FROM Sprachen WHERE ID = ' + Query.FieldByName('BezID').AsString);
  13.      Node := VST.AddChild(Root);
  14.      Data := VST.GetNodeData(Node);
  15.      Data^.Regelung := dbSprachen.FieldByName(FeldD).AsString;
  16.      Data^.Tag:= Query.FieldByName('ID').AsString;
  17.      VST.MultiLine[Node] := True;
  18.  
  19.      AddChilds(Query, Node, VST, Regelungsart);
  20.  
  21.      Query.Next;
  22.   end;
  23.  
  24.   Query.Free;
  25. end;
  26.  

Maybe i shouldn't walways bring the VST as param but this way it woks for every VST.

Anyway... thank u very much MR. GetMem. u realy saved me  :) :)

Edit: just saw ur Code and didn't expect it to be this easy... :o  so VirtualStringTree became sympathetic again  :D
« Last Edit: April 08, 2021, 10:28:22 am by Weitentaaal »
Lazarus: 2.0.12 x86_64-win64-win32/win64
Compiler Version: 3.2.2

balazsszekely

  • Guest
Re: VirtualTreeView MultiLine Cpomponents
« Reply #18 on: April 08, 2021, 11:46:31 am »
@Weitentaaal
You're welcome. I'm glad it's working.
By the way I saw a comment in your code, that you wish to implement bold text. I attach a final example with bold text.

Weitentaaal

  • Hero Member
  • *****
  • Posts: 503
  • Weitental is a very beautiful garbage depot.
Re: VirtualTreeView MultiLine Cpomponents
« Reply #19 on: April 08, 2021, 01:50:46 pm »
Thanks  :)
Lazarus: 2.0.12 x86_64-win64-win32/win64
Compiler Version: 3.2.2

 

TinyPortal © 2005-2018