Lazarus

Programming => General => Topic started by: bobonwhidbey on June 19, 2021, 01:07:50 am

Title: [Solved] How edit a VirtualDrawTree
Post by: bobonwhidbey 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.
Title: Re: How edit a VirtualDrawTree
Post by: jamie 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.
Title: Re: How edit a VirtualDrawTree
Post by: bobonwhidbey 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.
Title: Re: How edit a VirtualDrawTree
Post by: bobonwhidbey 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
Title: Re: How edit a VirtualDrawTree
Post by: jamie on June 19, 2021, 06:29:21 pm
getdisplayrect ?
Title: Re: How edit a VirtualDrawTree
Post by: bobonwhidbey 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.
TinyPortal © 2005-2018