Page 1 of 1

TDBTree - change font color based upon database field value?

Posted: Thu Oct 06, 2011 5:08 pm
by 7728351

TDBTree has properties for CodeField and ParentField, which gives a nice hierarchical display. I would like to be able to control the tree item text color that is displayed depending on the value of a database field.

The value of the database field would determine in which color the tree item text would be displayed. I would like the tree item text displayed in blue at the end of the tree (lowest level of the tree).

DBTree1.Color := clred; -- i tried this code but it colors the tree background in red and not individual tree items

I am hoping that the DBTree component is able to do this, and I cannot find it in the help file.
Could you please provide some sample code for me on how to implement this.
If this is not implemented please consider this a feature request.

Thank you in advance,


Re: TDBTree - change font color based upon database field value?

Posted: Tue Oct 11, 2011 11:20 am
by yeray
Hello Erik,

Excuse us for the delayed reply here.

You can format each shape as in the example at "What's New ?\Welcome !\Nodes\Format\Font" in the TeeTree demo included with the installation. Isn't it what you are trying to achieve? For example:

Code: Select all

If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.