Recent

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

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 502
    • 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 »
Win10 64-bit / Lazarus 32-bit 2.0.12 / FPC 3.2.0

jamie

  • Hero Member
  • *****
  • Posts: 4841
Re: How edit a VirtualDrawTree
« Reply #1 on: June 19, 2021, 04:59:08 pm »
I don't know what you expect ? This component is designed to be used at the lower levels which means you most likely need to process the OnCreateEditor event..
 
  That event looks like it's using a Interface as a base so that could mean you need to construct a class that has an inheritance of that interface as the editor of your choice..

  I only guessing here because I've never had the need for an editor yet.
The only true wisdom is knowing you know nothing

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 502
    • Double Dummy Solver - free download
Re: How edit a VirtualDrawTree
« Reply #2 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.
Win10 64-bit / Lazarus 32-bit 2.0.12 / FPC 3.2.0

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 502
    • Double Dummy Solver - free download
Re: How edit a VirtualDrawTree
« Reply #3 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
Win10 64-bit / Lazarus 32-bit 2.0.12 / FPC 3.2.0

jamie

  • Hero Member
  • *****
  • Posts: 4841
Re: How edit a VirtualDrawTree
« Reply #4 on: June 19, 2021, 06:29:21 pm »
getdisplayrect ?
The only true wisdom is knowing you know nothing

bobonwhidbey

  • Hero Member
  • *****
  • Posts: 502
    • Double Dummy Solver - free download
Re: How edit a VirtualDrawTree
« Reply #5 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.
Win10 64-bit / Lazarus 32-bit 2.0.12 / FPC 3.2.0

 

TinyPortal © 2005-2018