More than one component for IVTEditLink editor in VirtualTreeView

1.3k Views Asked by At

Is there a way how to add more than one component into VirtualTreeView's IVTEditLink editor ?

2

There are 2 best solutions below

1
On BEST ANSWER

I would use a standalone form as an editor container and leave the IVTEditLink concept for this purpose because:

  • if you use e.g. TPanel as an editor component container then you should consider to choose the right Parent of that TPanel; the editor with many fields may overlap either the bounds rectangle of your virtual tree or even bounds of your form
  • it's much more easier to implement OnDeactivate event to a form than to TPanel component
  • you can leave the IVTEditLink concept at all because it looses its sense here; the IVTEditLink was designed for specific node and column editors rather than for the whole nodes; you can simply open the form editor when the OnEditing event arrives, or at double click event etc.

But if I didn't convince you of leaving the IVTEditLink concept for node editing of more than one column then you can check this example for the implementation of a form as an editor for IVTEditLink interface.

3
On

Simply create your custom editors in OnCreateEditor event. Because this event provides Column parameter you can create different editors for different columns. E.g.:

procedure TForm1.OnCreateEditor(Sender: TBaseVirtualTree; Node: PVirtualNode;
  Column: TColumnIndex; out EditLink: IVTEditLink);
begin
  case Column of
    0: EditLink := TColorEditLink.Create;
    1: EditLink := TFontEditLink.Create;
  //etc..
  end;
end;