Recent

Author Topic: issue with Tvirtualstringtree node check boxes after updating to Laz 2.0.04  (Read 1945 times)

snorkel

  • Hero Member
  • *****
  • Posts: 817
Hi,
I updated last month to laz 2.0.4 and I compiled a app today that used  virtual tree view node checkboxes and the checkboxes are gone  the events fire and I can manipulate the node checkbox .i.e. set it checked etc but it's not painting anymore.  I am using the version 5.5.3.1 of the Virtual Tree view. 
The checkboxes did show up before, but I have to admit it may have been awhile since I compiled this particular app.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 817
update: I saw that the virtualtreeview is now included with laz 2 and up, so I uninstalled  the online package manager and installed the one shipped with Laz. Same issue.  Even when I enable the checkbox for one of the columns it does not draw.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

wp

  • Hero Member
  • *****
  • Posts: 11854
Please post a compilable simple project which shows the issue. I do see checkboxes in the "Advanced" demo of VTV. And if you cannot compile this demo (which is not included with Lazarus) look at the Online-Package-Manager which heavily uses VTV: it displays the checkboxes, too.
« Last Edit: October 15, 2019, 10:43:06 pm by wp »

balazsszekely

  • Guest
In order to see the checkboxes you need two things:
1. Add checksupport for tree: TreeOptions->MiscOptions->toCheckSupport(true)
2. Add checkbox to a particular node + change state if needed

Please verify if the following code works for you(rename tree to VST, then add OnGetText event + an OnCreate event for the form) :
Code: Pascal  [Select][+][-]
  1. type
  2.   PData = ^TData;
  3.   TData = record
  4.     FName: String;
  5.     FUniqueID: Integer;
  6.   end;
  7.  
  8. procedure TForm1.FormCreate(Sender: TObject);
  9. var
  10.   Node: PVirtualNode;
  11.   Data: PData;
  12. begin
  13.   VST.TreeOptions.MiscOptions := VST.TreeOptions.MiscOptions + [toCheckSupport];
  14.  
  15.   Node := VST.AddChild(nil); //add root node
  16.   Node^.CheckType := ctTriStateCheckBox; //checkbox for this node
  17.   VST.CheckState[Node] := csCheckedNormal; //change state to checked
  18.   Data := VST.GetNodeData(Node);
  19.   Data^.FName := 'test';
  20.   Data^.FUniqueID := 1;
  21. end;
  22.  
  23. procedure TForm1.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
  24.   Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);
  25. var
  26.   Data: PData;
  27. begin
  28.   Data := VST.GetNodeData(Node);
  29.   CellText := Data^.FName;
  30. end;
« Last Edit: October 16, 2019, 06:45:37 am by GetMem »

snorkel

  • Hero Member
  • *****
  • Posts: 817
Just a FYI, I had this all all working, this was not a case of a new project.
Anyways I figured it out, it was the checkimagekind property.  The value of ckDarkCheck no longer works on my windows system or my Linux system after updating to latest Laz release.
Changing it to: ckSystemDefault and it's all working again.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

wp

  • Hero Member
  • *****
  • Posts: 11854
The checkimages were recreated for high-dpi support. What does not work when you say "The value of ckDarkCheck no longer works..."?

 

TinyPortal © 2005-2018