[SOLVED] TreeView, Manual canel "Edited" event content and restore orignal? lazarus / 31-LCL ---------------------------------------------------------------------- jamie · 2017-10-07 18:54 Short of restoring the TEXT content of the node directly from my classes if the string reported isn't what I will accept.. I need a way the same as using the ESC key while editing a node in the tree? That will restore the text but, if user does not hit ESC and I don't accept the entry they put in reported at the OnEdited event, how do I manually perform the same ESC  to get back what is there?  currently restoring it is a pain In the butt!. ---------------------------------------------------------------------- jamie · 2017-10-07 19:19 I wanted to add that using StoreCurrentSelection and ApplyStoredSelection does not function inside the OnEDITED event.  I have a function "PopulateView" which would work just fine to restore all of the original contents, but that too is blocked while the OnEdited event is processing.  Seems the only fix is to reset the return string. ---------------------------------------------------------------------- jamie · 2017-10-07 19:31 Ok, disaster is averted   I made a copy of the Node.Text in the OnEditing event first and then in the OnEDITED event I used that copy to restore it. Now if I only knew how to change this to SOLVED! ---------------------------------------------------------------------- balazsszekely · 2017-10-07 19:35 Believe it or not I was typing almost the same solution but you were faster. Another method is to use lazmouseandkeyboard package then simulate a VK_ESCAPE. To mark the thread solved just put [SOLVED] in front of the thread title. ---------------------------------------------------------------------- jamie · 2017-10-07 20:28 Yes, much of us think alike  The V_ESCAPE won't work in this case because this is taking place within the OnEDITED event, the S string in the parameter needs to be changed.  I could do that from outside the control but not in this case, Node.Text is already changed and out of edit mode when it reaches this event.  Maybe the control should automatically store the old value if the OnEditing returns true to allow editing ?  This would make it easier "GetBeforeEditedNodestring" etc.. Thanks ---------------------------------------------------------------------- jamie · 2017-10-08 00:26 I just found a built in way, I don't know why I didn't see that before.... Smack forehead.  The Selected proper represents the current editing node, it also holds the original text. so in the OnEdited event, I can use the S := Selected.Text; so it simple replaces the text with the original... ---------------------------------------------------------------------- balazsszekely · 2017-10-08 04:57 @jamie You should give VirtualStringTree a try. It's like a TTreeView on steroids.