HOME  FORUM  LINKS

Site Menu

Development

Director

Hosting Support

Quick Links

Delphi Topics

Some Delphi code snippets aimed primarily at the novice Delphi user

TPageControl Example

This is a simple example to demonstrate how to move between tabsheets and how to hide and show a tab. Download Project

{-----------------------------------------------------------------------------
 Unit Name: tabExfrm
 Author:    Tony Domigan DOMAJ Pty. Ltd. http://www.domaj.com
 Purpose:   Simple TPageControl example
            Demonstrates: Tab selection, Hiding and showing Tabs
 History:
-----------------------------------------------------------------------------}

unit tabExfrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
   Forms,Dialogs, StdCtrls, ComCtrls, Buttons, ExtCtrls;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    StatusBar1: TStatusBar;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Panel1: TPanel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    SpeedButton7: TSpeedButton;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton7Click(Sender: TObject);
    procedure PageControl1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  PageControl1.ActivePage:=TabSheet1;
  StatusBar1.SimpleText:='TabSheet 1 Selected';
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
  PageControl1.ActivePage:=TabSheet2;
  StatusBar1.SimpleText:='TabSheet 2 Selected';
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
  PageControl1.ActivePage:=TabSheet3;
  StatusBar1.SimpleText:='TabSheet 3 Selected';
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
  PageControl1.ActivePage:=TabSheet4;
  StatusBar1.SimpleText:='TabSheet 4 Selected';
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
  PageControl1.Pages[3].TabVisible:=False;
  StatusBar1.SimpleText:='TabSheet 4 Hidden';
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
  PageControl1.Pages[3].TabVisible:=True;
  //PageControl1.ActivePage:=TabSheet4;
  StatusBar1.SimpleText:='TabSheet 4 Made Visible';
end;

procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
  close;
end;

procedure TForm1.PageControl1Change(Sender: TObject);
begin
  StatusBar1.SimpleText:='TabSheet '+
                          intToStr(PageControl1.ActivePageIndex+1)+
                          ' Selected by Click on Tab';
end;

end.

Recent Topics

The latest topics from the forum.

  1. k-director.com: Post Updates
  2. A blog about Adobe Director
  3. Centerstage
  4. Custom Cursor...Why It Does Not Work?
  5. Director Game!
  6. cross platform
  7. database xtra for both mac and windows
  8. from windows to MAC
  9. SLIDER POSITION...
  10. Bullet points in text member
  11. Any VideoOut plugin / xtras for director mx ??
  12. Activex component install
  13. quiz
  14. how to export embedded flash swf?
  15. A BIG PROBLEM...
  16. Spining a model on a touchscreen
  17. 3D Fountain trail to avoid the Cursor
  18. HTTP
  19. SHOCKWAVE VIDEO
  20. Deleting Lines Comparing Time...I Have No Idea...
  21. Property not found error
  22. SHOCKWAVE PROBLEM
  23. PROBLEM SHOCKWAVE
  24. text field focus
  25. ExitLock CloseRequest Quit Close Gadget
  26. convert read only
  27. F10 Key Code Does Not Work
  28. Director Game Development Survey
  29. baPrintFile()
  30. How do check if a printer is printing??

Useful Links

Google Translate
AltaVista Translate
Google Glossary

Google
Web www.domaj.com