Hi
I've been thinking that it would be a very useful feature if one could "embed" or add the functionality of common visual components as nodes in a teetree. For example, is there a way of adding a drop-down listbox as a node to a teetree? Something like a drop-down lookup list in a DBGrid.
Listbox as node in teetree
-
- Newbie
- Posts: 3
- Joined: Sun Mar 09, 2003 5:00 am
- Contact:
Hi,
You can handle this in the AfterDraw event, eg:
Another way might be to create your own shape descendants.
Kind regards,
tom
You can handle this in the AfterDraw event, eg:
Code: Select all
{ Draw a control at a node position... }
Procedure DrawControl(AControl:TControl; AShape:TTreeNodeShape);
var P:TPoint;
begin
AControl.Visible:=AShape.Visible;
if AControl.Visible then
begin
With AShape do P:=Tree.Canvas.Calculate3DPosition(X0,Y0,0);
AControl.Left:=P.x;
AControl.Top:=P.y;
end;
end;
procedure TFormControls.Tree1AfterDraw(Sender: TObject);
begin
DrawControl(Button1,TreeShape26);
DrawControl(Edit1,TreeShape27);
DrawControl(ComboBox1,TreeShape23);
DrawControl(ListBox1,TreeShape16);
DrawControl(RadioGroup1,TreeShape15);
DrawControl(StringGrid1,TreeShape24);
end;
Another way might be to create your own shape descendants.
Kind regards,
tom
-
- Newbie
- Posts: 3
- Joined: Sun Mar 09, 2003 5:00 am
- Contact:
Super help!
Thank you very much, Tom . Works beautifully.