Recent

Author Topic: Missing information related to an old release notes  (Read 422 times)

jipété

  • Full Member
  • ***
  • Posts: 194
Missing information related to an old release notes
« on: May 17, 2025, 06:26:22 pm »
Hello,

Reading these lines (https://wiki.freepascal.org/Lazarus_1.2.0_release_notes#LCL_TTreeView_with_Images_no_longer_indents_nodes_without_image), I don't know what to do with the PaintImages parameter found in the last line.
I don't know where it comes from, I don't know how to use it, configure it.

Best regards and thanks for your help.

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Missing information related to an old release notes
« Reply #1 on: May 17, 2025, 07:15:10 pm »
I believe the note is referring to method customdrawitem, see here.

Each individual node in the tree can have a (valid) image index when the images are set and the event linked in the docs is afaik used to indicate that the image should be drawn (or not).

Check the individual customdraw events in order to see which ones make actual use of the paintimages boolean. As an example, OnAdvancedcustomdraw event makes use of it.

« Last Edit: May 17, 2025, 07:18:25 pm by TRon »
Today is tomorrow's yesterday.

jipété

  • Full Member
  • ***
  • Posts: 194
Re: Missing information related to an old release notes
« Reply #2 on: May 17, 2025, 07:38:53 pm »
Thank you for your quick response.
Give me a few days to look into this.

Best Regards,

jipété

  • Full Member
  • ***
  • Posts: 194
Re: Missing information related to an old release notes
« Reply #3 on: May 20, 2025, 03:19:16 pm »
Hello,

I found another solution, simpler in my opinion:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.tv1MouseDown(Sender: TObject; Button: TMouseButton;
  2.   Shift: TShiftState; X,Y: Integer);
  3. var
  4.   tn, WorkNode, tmpNode: TTreeNode;
  5.   s, root, target: string;
  6.   sl: TStringList;
  7. begin
  8. .....
  9.     root := WorkNode.Text +'/'+ tn.Text; // tn is the selected treenode
  10.     tv1.BeginUpdate;
  11.     for i := 0 to sl.Count -1 do begin
  12.       s := CleanFolderName(sl[i]); // custom proc for cleaning filelistbox folders (will remove [ & ])
  13.       tmpNode := tv1.Items.AddChild(tv1.Selected, s);
  14.       target := root +'/'+ tmpNode.Text;
  15.  
  16.       if IsDirectory(target) then
  17.       with tmpNode do begin
  18.         HasChildren := True;
  19.         StateIndex:=ImgIndexUncheck;
  20.         ImageIndex:=4; SelectedIndex:=4; end;
  21.       else
  22.         if (LowerCase(ExtractFileExt(s)) = '.ttf')
  23.         or (LowerCase(ExtractFileExt(s)) = '.ttc')
  24.         or (LowerCase(ExtractFileExt(s)) = '.otf')
  25.         then begin tmpNode.ImageIndex:=2; tmpNode.SelectedIndex:=2; end
  26.         else begin tmpNode.ImageIndex:=3; tmpNode.SelectedIndex:=3; end;
  27.     end; // for i
  28.     tv1.EndUpdate;
  29. .....
  30. end;

But I can't figure out how to not open the items' label editor : see attached editing_open.png
Any idea welcome.
« Last Edit: May 20, 2025, 03:21:32 pm by jipété »

 

TinyPortal © 2005-2018