Acessing nodeproperties from InplaceEditor event

Hi, I have a FNCTreeView with various InplaceEditors.

For one of the inplaceeditors, which is a custom descendant of TNumberBox, i want to use the OnChangeValue event.

My challenge is that i need to access properties of the TreeViewNode containing the inplaceeditor, but when the event is fired the parent and owner property of sender is the TreeView, not the node.

How can i access/find the corresponding node in the event handler?

Code excerpt:

//Editor constructor
constructor TNumberBoxTP.Create(AOwner:TComponent);
begin
  inherited create(AOwner);  //Owner is the tree
  with self do begin
    OnChangeValue:=TDetailTree(AOwner).onTPChange;
  end;
end;

//event handler
procedure TDetailTree.onTPChange(Sender: TObject);
begin
  showMessage(TComponent(sender).GetParentComponent.ClassName);  //Finds Tree
  showMessage(TComponent(sender).Owner.ClassName);  //Finds Tree
end;

You could use the OnBeforeOpenInplaceEditorNode and save a reference to the node, and use that reference.

Thank you

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.