Search code examples
firemonkeydelphi-10.1-berlin

How to change text settings in a selected item in a FireMonkey TTreeView


I'm using a TStyleBook to create a custom TTreeView in a simple Windows application. I can access the "selection" StyleObject in the TreeViewStyle but I don't know how to change the font color of the selected item (or how to change any TextSettings for that matter). Is it possible to choose a style for the text while the item is selected? How can it be done?

Developing in Rad Studio 10.1 Berlin in a Windows 10 environment.

Thanks in advance.


Solution

  • In the end I was approaching the problem the wrong way.

    My solution was to create a TreViewItemStyle and change the properties of its TActiveStyleTextObject (in Delphi Berlin 10.1 a object called "text").

    For the especific problem of changing the text color while the item is selected I just changed the ActiveColor property to my desired color.