Recent

Author Topic: [Solved] TTreeNode has a property NodeEffect. How can it be used?  (Read 548 times)

dirkjvanderveen

  • Newbie
  • Posts: 3
TTreeNode has a property NodeEffect of type TGraphicsDrawEffect. I would like to gray out some nodes and there is indeed an NodeEffect gdeDisabled.
However, using it (setting it at directly after the creation of that node) has no effect. At least on Lazarus/FPC 2.2.4 and MacOS.

How can the TTreeNode.NodeEffect be used?
« Last Edit: January 25, 2023, 06:53:27 pm by dirkjvanderveen »

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: TTreeNode has a property NodeEffect. How can it be used?
« Reply #1 on: January 25, 2023, 06:06:49 pm »
Arguments of type TGraphicsDrawEffect can optionally be used when drawing images out of an ImageList. The LCL performs a simple image manipulation to show the image in some specific state, e.g. grayed when the image represents a disabled item (gedDisabled). Or sometimes toolbar or menu icons are increased in brightness when the mouse hovers over them.

So, when you set the NodeEffect of a tree node to gdeDisabled it will be grayed out.

The attached demo cycles through all effects for the selected node by clicking on the button.

[EDIT]
Ah, you mentioned macOS... Could be that the node effects are not implemented for cocoa. I wrote and tested the demo project on Windows.

[EDIT2]
No - the NodeEffects are working in macOS. (But I noticed that the SelectedIndex always returns to -1...)
« Last Edit: January 25, 2023, 06:22:11 pm by wp »

dirkjvanderveen

  • Newbie
  • Posts: 3
Re: TTreeNode has a property NodeEffect. How can it be used?
« Reply #2 on: January 25, 2023, 06:51:48 pm »
Thanks wp, your answer was very helpful!

 

TinyPortal © 2005-2018