Hello Fbilo.
I would take a different approach here. When the user clicks the add or the edit button, I assume that you change the form's mode. When you do this, you should disable the TreeView like so:
Thisform.oTree.object.enabled = .F.
and re-enable it again after you do the save.