home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Examples / Apps / Tab / MAIN.CPP next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  2.1 KB  |  56 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "main.h"
  10. #include <stdlib.h>
  11. //---------------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TForm1 *Form1;
  14. //---------------------------------------------------------------------------
  15. __fastcall TForm1::TForm1(TComponent* Owner)
  16.     : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TForm1::TabControl1Change(TObject *Sender)
  21. {
  22.     char buf[3];
  23.  
  24.     if (TabControl1->TabIndex == -1)
  25.         StatusBar1->SimpleText = "No tab selected.";
  26.     else
  27.     {
  28.         StatusBar1->SimpleText = "Tab index: " +
  29.                                  AnsiString(itoa(TabControl1->TabIndex, buf, 10));
  30.  
  31.         switch (TabControl1->TabIndex)
  32.         {
  33.             case 0:
  34.                 Label1->Caption = "This is an example of using a tab control.";
  35.                 break;
  36.             case 1:
  37.                 Label1->Caption = "The OnChange event is triggered when the user selects a tab."
  38.                                   "  The TabIndex property tells you which tab was selected.";
  39.                 break;
  40.             case 2:
  41.                 Label1->Caption = "Using a TabControl, much of the work is left up to the developer.";
  42.                 break;
  43.             case 3:
  44.                 Label1->Caption = "For multi-page dialogs, a PageControl with "
  45.                                   "TabSheets for each page is much more powerful.";
  46.                 break;
  47.             case 4:
  48.                 Label1->Caption = "See the \"MULTIPAGE\" example to learn more about TPageControl and TTabSheet.";
  49.                 break;
  50.             default:
  51.                 break;
  52.         }
  53.     }
  54. }
  55. //---------------------------------------------------------------------------
  56.