Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top