Re:Question about the Treeview
Ben,
Here is a better way to do it. The last one didn't work properly.
procedure TForm1.FormActivate(Sender: TObject);
begin
PageControl1.ActivePage:=TabSheet1;
end;
procedure TForm1.TreeView1Change(Sender: TObject; Node: TTreeNode);
begin
case Integer(TreeView1.Selected.Index) of
0:PageControl1.ActivePage:= TabSheet1;
1:PageControl1.ActivePage:= TabSheet2;
2:PageControl1.ActivePage:= TabSheet3;
3:PageControl1.ActivePage:= TabSheet4;
end;
end;
procedure TForm1.PageControl1Change(Sender: TObject);
begin
TreeView1.Selected :=
TreeView1.Items[PageControl1.ActivePage.PageIndex];
end;
The snag is you have to add to the CASE statement each time you put a
new TabSheet in. You could fiddle around with a For loop to do it
automatically or try other properties.
Hope this gets you going,
Ian Millward
Quote
>Hi,
>I want to use a treeview to select specific page.
>I have three options:
>- 1) Accounting
>- 2) Pen settins
>- 3) Job parameters
>I want to use a pagecontrol to change my active page?
>How can i select a item and then change my pagecontrol?
>Regards,
>Ben van Erp