[Lazarus] TTreeView events OnCreateNodeClass and OnAddition

Juha Manninen juha.manninen at phnet.fi
Sat May 1 16:42:09 CEST 2010


Andrew Haines wrote:
> > Delphi compatibility issue again. TTreeView is missing events:
> >   TTreeView.OnCreateNodeClass and 
> 
> LCL has TTreeView.OnCustomCreateItem which may do what you want for this

Now this may be a stupid question but what is the easiest way to use node 
class derived from TTreeNode, instead of TTreeNode itself?

In the program I try to port there is:

  TViewNode = class(TTreeNode)
  ...

Then OnCreateNodeClass handler is used only to indicate the node class type:

  procedure TTreeViewIntegrator.tvModelCreateNodeClass(
    Sender:   TCustomTreeView; var NodeClass: TTreeNodeClass);
  begin
    NodeClass := TViewNode;
  end;


In OnCustomCreateItem handler I would need to actually create the node and 
take care of owner and parent or siblings or whatever.


Regards,
Juha




More information about the Lazarus mailing list