Recent

Author Topic: lazarus tvirtualstringtree drop files  (Read 3711 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
lazarus tvirtualstringtree drop files
« on: April 09, 2017, 06:53:56 pm »
Hello guys, who tells me how to do a drag and drop files to a tvirtualstringtree

So to take the names and file paths drawn on the component?

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

balazsszekely

  • Guest
Re: lazarus tvirtualstringtree drop files
« Reply #1 on: April 09, 2017, 08:54:00 pm »
What did you try so far?

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: lazarus tvirtualstringtree drop files
« Reply #2 on: April 09, 2017, 11:30:35 pm »
Thanks for your example. On Linux under gtk2, it has a memory leak in the painting. Lines 29972 and 23592 of VirtualTrees.pas are listed along with lots of other consequent LCL pp and inc files.
Is this a known gtk2 bug of VirtualStringTree?

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: lazarus tvirtualstringtree drop files
« Reply #3 on: April 10, 2017, 12:30:57 am »
No, Please create a bug report with a sample project

balazsszekely

  • Guest
Re: lazarus tvirtualstringtree drop files
« Reply #4 on: April 10, 2017, 05:32:02 am »
@howardpc, @LuizAmérico

I don't think it's a bug, I forget to free the data. The following code should solve the problem:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.VSTFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
  2. var
  3.   FileData: PFileData;
  4. begin
  5.   FileData := VST.GetNodeData(Node);
  6.   Finalize(FileData^);
  7. end;
  8.  

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
Re: lazarus tvirtualstringtree drop files
« Reply #5 on: April 10, 2017, 11:30:36 am »
Thanks, your example is perfect. But unfortunately I think it's mandatory properties toAcceptOLEDrop

But not on my program makes me select. I do not know if it's a Mac problem or conflict with anything else. You tell me what are the options to set mandatory virtualstringtree?

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018