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. Before Closing.Stop
  2. Stop A Script
  3. Buttons On Stage And Movie On A Window...
  4. Acrobat 8 and Director
  5. Flash Video And Director
  6. Problem with new install
  7. Urgent Help For Noob, Pretty Please?
  8. back to splashscreen when inactive
  9. Import Flash
  10. my truck game --- help
  11. opening microsoft word document and microsoft powerpoint slides
  12. My Director has no Text Field
  13. Toggle Sound On/Off for AVI Video
  14. Keyboard Input Fails to Trigger Handlers
  15. Center Movie In A Window
  16. Microsoft Word Web Browser v1.0
  17. Sine Graph Function
  18. The coloured problems
  19. A Little fix or two
  20. Sine Reverse
  21. Repeatedly replacing Director bitmap
  22. Japanese characters in Director MX
  23. k-director.com: Post Updates
  24. A blog about Adobe Director
  25. Centerstage
  26. Custom Cursor...Why It Does Not Work?
  27. Director Game!
  28. SLIDER POSITION...
  29. Bullet points in text member
  30. Activex component install
  31. quiz
  32. how to export embedded flash swf?
  33. SHOCKWAVE VIDEO
  34. Deleting Lines Comparing Time...I Have No Idea...
  35. Property not found error
  36. SHOCKWAVE PROBLEM
  37. text field focus
  38. ExitLock CloseRequest Quit Close Gadget
  39. F10 Key Code Does Not Work
  40. Director Game Development Survey
  41. baPrintFile()
  42. How do check if a printer is printing??

Useful Links

Google Translate
AltaVista Translate
Google Glossary

Google
Web www.domaj.com

EZ BAS Easy BAS.

Save hours of work on your Business Activity Statement using this simple, quick and efficient product.