Recent

Author Topic: HOWTO: Prevent editing of TTreeNode  (Read 283 times)

Marion

  • Jr. Member
  • **
  • Posts: 90
HOWTO: Prevent editing of TTreeNode
« on: May 05, 2021, 10:24:58 pm »
I am using the TTreeView but I don't want users to be able to edit the node text. How do I prevent that?
Thank you,
Marion
(A recovering Windows programmer.)

jamie

  • Hero Member
  • *****
  • Posts: 4563
Re: HOWTO: Prevent editing of TTreeNode
« Reply #1 on: May 05, 2021, 10:44:28 pm »
maybe in options property  tvoReadOnly checked.


Also there is the OnEditing event where you can instruct it to not allow it to be editable
« Last Edit: May 05, 2021, 10:48:22 pm by jamie »
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 8349
Re: HOWTO: Prevent editing of TTreeNode
« Reply #2 on: May 05, 2021, 10:51:49 pm »
There is also a more direct ReadOnly property; it definitely works, I used it many times.

In case that you only want to inhibit editing of specific nodes you can hook into the OnEditing event which offers a var parameter "AllowEdit" which you simply must set to false in the event handler for the corresponding node.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Marion

  • Jr. Member
  • **
  • Posts: 90
Re: HOWTO: Prevent editing of TTreeNode
« Reply #3 on: May 06, 2021, 12:33:27 am »
Thank you all.
Thank you,
Marion
(A recovering Windows programmer.)

 

TinyPortal © 2005-2018