1

How can I set the TreeView's selected node to the default clHighlight color when the TreeView is not focused? I tried this code in the CustomDrawItem and AdvancedCustomDrawItem events - no luck:

if (cdsSelected in State) then Sender.Canvas.Brush.Color := clHighlight; 

Also tried the change the .HideSelection property, makes no difference, still using that very light gray color. I'm using D7.

1 Answer 1

1

Source of problem found:

// does nothing, still grayed when losing focus if (cdsSelected in State) then Sender.Canvas.Brush.Color := clHighlight; // works fine if (cdsSelected in State) then Sender.Canvas.Brush.Color := ColorToRGB(clHighlight); 

For some reason the clHighlight color can not be used, probably there is some condition in the TTreeView code which is checking against this color and does something differently.

Sign up to request clarification or add additional context in comments.

1 Comment

That's not specific to TTreeView. I would guess the handling is when the form loads properties, because you always need to do the conversion when setting them in code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.