Recent

Author Topic: [Solved] How edit a VirtualDrawTree  (Read 3992 times)

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 590
    • Double Dummy Solver - free download
[Solved] How edit a VirtualDrawTree
« on: June 19, 2021, 01:07:50 am »
Is it possible to edit a VDT? It seems that it's crucial to have the onGetText and onNewText events of the VirtualStringTree, which are both missing from a VDT. Is there a way around this problem?  Selecting toEditable of TreeOptions->MiscOptions of a VDT hasn't worked for me.
« Last Edit: June 19, 2021, 08:04:06 pm by bobonwhidbey »
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 590
    • Double Dummy Solver - free download
Re: How edit a VirtualDrawTree
« Reply #1 on: June 19, 2021, 05:16:06 pm »
What I'm looking for is a VirtualStringTree that allows me to have more control over displaying each line or column. In particular, I need the ability to have different font colors for different parts of some string output. Different font styles too and background.  This is all possible in this Lazarus forum as well as with the VDT. Is there a way to do that with a VST; e.g. an OwnerDraw capability? Perhaps the VTS onDrawText or the onPaintText events would allow that but I haven't figured out how to use that capability, nor what the StringOption toShowStaticText is all about.
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 590
    • Double Dummy Solver - free download
Re: How edit a VirtualDrawTree
« Reply #2 on: June 19, 2021, 06:00:16 pm »
I guess the biggest benefit of the VDT onDrawNode event is the ability to determine where on the line the content is to be displayed. This is found in PaintInfo.ContentRect.

Is there a way to determine that in the VST onPaintText
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 590
    • Double Dummy Solver - free download
Re: How edit a VirtualDrawTree
« Reply #3 on: June 19, 2021, 08:03:48 pm »
Thank you Jamie for your help. You're right, there's no need for the VirtualDrawTree. The VirtualStringTree seems to meet all my needs;  editing and all the other benefits of the VST. In particular the onDrawText event which includes the CellRect.
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64

 

TinyPortal © 2005-2018