Assistente - montando um assistente com pagecontrol |
Top Previous Next |
|
// como fazer um assistente com várias páginas usando um PAGECONTROL:
// form (RESUMIDO) object Form1: TForm1 object PageControl1: TPageControl ActivePage = TabSheet1 Align = alClient object TabSheet1: TTabSheet Caption = 'TabSheet1' TabVisible = False object Label1: TLabel object Label2: TLabel object Button1: TButton Caption = 'Next >' end object Button2: TButton Caption = '< Prior' Enabled = False end end object TabSheet2: TTabSheet Caption = 'TabSheet2' TabVisible = False end object TabSheet3: TTabSheet Caption = 'TabSheet3' TabVisible = False end end end
// unit procedure TForm1.Button1Click(Sender: TObject); begin PageControl1.ActivePageIndex := PageControl1.ActivePageIndex + TComponent(Sender).Tag; Button2.Enabled := PageControl1.ActivePageIndex <> 0; Button1.Enabled := PageControl1.ActivePageIndex <> PageControl1.PageCount-1; // atualiza tela Button1.Parent := PageControl1.ActivePage; Button2.Parent := PageControl1.ActivePage; Label1.Parent := PageControl1.ActivePage; Label2.Parent := PageControl1.ActivePage; Label2.Caption := IntToStr(PageControl1.ActivePageIndex + 1); end;
|