Chapter 07 - Project Pages |
Project Structure
| Pages.dpr |
program Pages;
uses
Forms,
PagesF in 'PagesF.pas' ;
begin
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| PagesF.pas |
unit PagesF;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls, ImgList;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
ListBox1: TListBox;
BitBtnPrevious: TBitBtn;
BitBtnNext: TBitBtn;
EditWidth: TEdit;
UpDown1: TUpDown;
Label1: TLabel;
CheckBoxMultiLine: TCheckBox;
CheckBoxVisible: TCheckBox;
BitBtnApply: TBitBtn;
Memo1: TMemo;
Label2: TLabel;
EditHeight: TEdit;
UpDown2: TUpDown;
Label3: TLabel;
BitBtnChange: TBitBtn;
ImageList1: TImageList;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
BitBtnAdd: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure BitBtnApplyClick(Sender: TObject);
procedure BitBtnChangeClick(Sender: TObject);
procedure BitBtnNextClick(Sender: TObject);
procedure BitBtnPreviousClick(Sender: TObject);
procedure Memo1Change(Sender: TObject);
procedure BitBtnAddClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 0 to PageControl1.PageCount -1 do
begin
ListBox1.Items.Add (
PageControl1.Pages [I].Caption);
Memo1.Lines.Add (
PageControl1.Pages [I].Caption);
end;
EditWidth.Text := IntToStr (PageControl1.TabWidth);
EditHeight.Text := IntToStr (PageControl1.TabHeight);
PageControl1.ActivePage := TabSheet1;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
PageControl1.ActivePage :=
PageControl1.Pages [ListBox1.ItemIndex];
end;
procedure TForm1.BitBtnApplyClick(Sender: TObject);
begin
PageControl1.TabWidth := StrToInt (EditWidth.Text);
PageControl1.TabHeight := StrToInt (EditHeight.Text);
PageControl1.MultiLine := CheckBoxMultiLine.Checked;
TabSheet3.TabVisible := CheckBoxVisible.Checked;
if RadioButton1.Checked then
PageControl1.TabPosition := tpTop
else
PageControl1.TabPosition := tpLeft;
end;
procedure TForm1.BitBtnChangeClick(Sender: TObject);
var
I: Integer;
begin
if Memo1.Lines.Count = PageControl1.PageCount then
for I := 0 to PageControl1.PageCount -1 do
PageControl1.Pages [I].Caption := Memo1.Lines [I];
BitBtnChange.Enabled := False;
end;
procedure TForm1.BitBtnNextClick(Sender: TObject);
begin
PageControl1.ActivePage :=
PageControl1.FindNextPage (
PageControl1.ActivePage, True, False);
end;
procedure TForm1.BitBtnPreviousClick(Sender: TObject);
begin
PageControl1.SelectNextPage (False);
end;
procedure TForm1.Memo1Change(Sender: TObject);
begin
BitBtnChange.Enabled := True;
end;
procedure TForm1.BitBtnAddClick(Sender: TObject);
var
strCaption: string;
NewTabSheet: TTabSheet;
begin
strCaption := 'New Tab';
if InputQuery ('New Tab', 'Tab Caption', strCaption) then
begin
NewTabSheet := TTabSheet.Create (PageControl1);
NewTabSheet.Visible := True;
NewTabSheet.Caption := strCaption;
NewTabSheet.PageControl := PageControl1;
PageControl1.ActivePage := NewTabSheet;
Memo1.Lines.Add (strCaption);
ListBox1.Items.Add (strCaption);
end;
end;
end.
| PagesF.dfm |
object Form1: TForm1
Left = 258
Top = 117
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Pages Test'
ClientHeight = 276
ClientWidth = 321
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
OnCreate = FormCreate
DesignSize = (
321
276)
PixelsPerInch = 96
TextHeight = 13
object PageControl1: TPageControl
Left = 0
Top = 0
Width = 321
Height = 276
ActivePage = TabSheet1
Align = alClient
HotTrack = True
Images = ImageList1
TabIndex = 0
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'Pages'
DesignSize = (
313
247)
object Label3: TLabel
Left = 216
Top = 16
Width = 88
Height = 65
HelpType = htKeyword
Anchors = [akTop, akRight]
AutoSize = False
Caption = 'Click on the listbox to change page'
WordWrap = True
end
object ListBox1: TListBox
Left = 16
Top = 16
Width = 193
Height = 212
Anchors = [akLeft, akTop, akRight, akBottom]
ItemHeight = 13
TabOrder = 0
OnClick = ListBox1Click
end
end
object TabSheet2: TTabSheet
Caption = 'Tabs Size'
ImageIndex = 1
DesignSize = (
313
247)
object Label1: TLabel
Left = 24
Top = 32
Width = 58
Height = 13
HelpType = htKeyword
Caption = 'Tabs &Width:'
FocusControl = EditWidth
end
object Label2: TLabel
Left = 24
Top = 76
Width = 61
Height = 13
HelpType = htKeyword
Caption = 'Tabs &Height:'
FocusControl = EditHeight
end
object EditWidth: TEdit
Left = 108
Top = 28
Width = 65
Height = 21
TabOrder = 0
Text = '0'
end
object UpDown1: TUpDown
Left = 173
Top = 28
Width = 15
Height = 21
Associate = EditWidth
Min = 0
Max = 2000
Position = 0
TabOrder = 1
Thousands = False
Wrap = False
end
object CheckBoxMultiLine: TCheckBox
Left = 24
Top = 120
Width = 97
Height = 17
Caption = '&Multi-Line Tabs'
TabOrder = 2
end
object CheckBoxVisible: TCheckBox
Left = 144
Top = 120
Width = 121
Height = 17
Caption = '&Last Tabs &Visible'
Checked = True
State = cbChecked
TabOrder = 3
end
object BitBtnApply: TBitBtn
Left = 228
Top = 26
Width = 75
Height = 26
Anchors = [akTop, akRight]
Caption = '&Apply'
ModalResult = 4
TabOrder = 4
OnClick = BitBtnApplyClick
Glyph.Data =
NumGlyphs = 2
end
object EditHeight: TEdit
Left = 108
Top = 72
Width = 65
Height = 21
TabOrder = 5
Text = '0'
end
object UpDown2: TUpDown
Left = 173
Top = 72
Width = 15
Height = 21
Associate = EditHeight
Min = 0
Max = 2000
Position = 0
TabOrder = 6
Thousands = False
Wrap = False
end
object GroupBox1: TGroupBox
Left = 24
Top = 150
Width = 89
Height = 69
Caption = 'Tab Position'
TabOrder = 7
object RadioButton1: TRadioButton
Left = 8
Top = 20
Width = 49
Height = 17
Caption = 'Top'
Checked = True
TabOrder = 0
TabStop = True
end
object RadioButton2: TRadioButton
Left = 8
Top = 43
Width = 49
Height = 17
Caption = 'Left'
TabOrder = 1
end
end
end
object TabSheet3: TTabSheet
Caption = 'Tabs Text'
ImageIndex = 2
DesignSize = (
313
247)
object Memo1: TMemo
Left = 16
Top = 16
Width = 193
Height = 213
Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 0
OnChange = Memo1Change
end
object BitBtnChange: TBitBtn
Left = 228
Top = 18
Width = 75
Height = 26
Anchors = [akTop, akRight]
Caption = '&Change'
Enabled = False
ModalResult = 4
TabOrder = 1
OnClick = BitBtnChangeClick
Glyph.Data =
NumGlyphs = 2
end
object BitBtnAdd: TBitBtn
Left = 229
Top = 52
Width = 74
Height = 26
Caption = 'Add Page...'
TabOrder = 2
OnClick = BitBtnAddClick
end
end
end
object BitBtnPrevious: TBitBtn
Left = 232
Top = 232
Width = 75
Height = 26
Anchors = [akRight, akBottom]
Caption = '&Previous'
TabOrder = 1
OnClick = BitBtnPreviousClick
Glyph.Data =
NumGlyphs = 2
end
object BitBtnNext: TBitBtn
Left = 232
Top = 200
Width = 75
Height = 26
Anchors = [akRight, akBottom]
Caption = '&Next'
Default = True
TabOrder = 2
OnClick = BitBtnNextClick
Glyph.Data =
Layout = blGlyphRight
NumGlyphs = 2
end
object ImageList1: TImageList
Left = 44
Top = 56
Bitmap = 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000FF7F0000
FF7F0000000000000000FF7FFF7FFF7F00000000000000000000000000000000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000FF7F0000FF7F0000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000000000000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7F000000000000000000000000FF7F00000000000000000000000000000000
FF7F00000000FF7F000000000000FF7F00000000000000000000000000001042
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000000000000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000010420000
0000000000000000000010420000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7F000000000000000000000000FF7F0000000000000000007C000000000000
FF7F0000186300000000FF7F0000FF7F00000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F0000000000000000007C007C00000000
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000000000000000
1042000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7F000000000000FF7FFF7FFF7FFF7F00000000007C007C007C007C007C0000
FF7F00000000FF7F000000000000000000000000000000000000000000001042
0000000000000000104200000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7FFF7FFF7FFF7FFF7F00000000000000000000007C007C007C007C007C007C
0000FF7FFF7FFF7F0000FF7FFF7F000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7F00000000FF7FFF7F0000FF7F000000000000007C007C007C007C007C007C
007C00001863FF7F0000FF7F0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
FF7FFF7FFF7FFF7FFF7F00000000000000000000007C007C007C007C007C007C
0000FF7FFF7FFF7F000000000000000000000000000000000000000000000000
1042000000001042000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F0000FF7F0000
0000000000000000000000000000000000000000007C007C007C007C007C0000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000FF7F000000000000
000000000000000000000000000000000000000000000000007C007C00000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F00000000000000000000
000000000000000000000000000000000000000000000000007C000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000200000000100010000000000000100000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000FC00FFFFFFFF0000F000FC00FFFF0000
C000FC00F18300000000FC00FBC700000000FC00F9C700000000EC00F8070000
0000E400FD8F00000000E000FC8F000000000000FC8F000000000001FE1F0000
00010003FE1F000000030007FE1F00000007000FFF3F0000001FE3FFFF7F0000
007FE7FFFFFF000001FFEFFFFFFF0000}
end
end
|
|