Logo New book: Delphi 2007 Handbook
My blog in online
Delphi tech support service: support.marcocantu.com
Google
  Web www.marcocantu.com

Menu for Development

Site Menu
Delphi 2007 Handbook
Mastering Borland Delphi 2005
Essential Pascal
Essential Delphi
Buy Books Online
Code Repository
Newsgroups
White Papers
Tools
Conferences
Training
Delphi Links
Contact Marco

My Other Sites
Italian Site (www.marcocantu.it)
Developers Newsgroups Browser (dev.newswhat.com)
My town (www.piazzacavalli.net)
the delphi search
Wintech Italia (my company)

Breaking News
Buy Mastering Borland Delphi 2005 from Amazon
Free ebook: Mastering Delphi Update for Delphi 2006

Advertising
Home My Blog Books My Bookstore Development Links Marco


Home: Code Repository: Mastering Delphi 6

Chapter 08 - Project DockPage

Project Structure

DockPage.dpr
program DockPage;

uses
  Forms,
  DockPF in 'DockPF.pas' {Form1},
  EditForm in 'EditForm.pas' {Form2},
  CalForm in 'CalForm.pas' {Form3};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.Run;
end.
DockPF.pas
unit DockPF;

interface

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

type
  TForm1 = class(TForm)
    Splitter1: TSplitter;
    Memo1: TMemo;
    Panel1: TPanel;
    ListBox1: TListBox;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  PageControl1.BeginDrag (False, 10);
end;

end.
EditForm.pas
unit EditForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm2 = class(TForm)
    Memo1: TMemo;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

end.
CalForm.pas
unit CalForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls;

type
  TForm3 = class(TForm)
    MonthCalendar1: TMonthCalendar;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.DFM}

end.
DockPF.dfm
object Form1: TForm1
  Left = 287
  Top = 208
  Width = 555
  Height = 411
  Caption = 'Docking Pages'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Splitter1: TSplitter
    Left = 267
    Top = 0
    Width = 3
    Height = 384
    Cursor = crHSplit
    HelpType = htKeyword
  end
  object Memo1: TMemo
    Left = 270
    Top = 0
    Width = 277
    Height = 384
    Align = alClient
    Lines.Strings = (
      'Text...')
    TabOrder = 0
  end
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 267
    Height = 384
    Align = alLeft
    DockSite = True
    TabOrder = 1
    OnMouseDown = Panel1MouseDown
    object PageControl1: TPageControl
      Left = 1
      Top = 1
      Width = 265
      Height = 382
      ActivePage = TabSheet1
      Align = alClient
      DockSite = True
      DragKind = dkDock
      TabIndex = 0
      TabOrder = 0
      object TabSheet1: TTabSheet
        Caption = 'List'
        object ListBox1: TListBox
          Left = 0
          Top = 0
          Width = 257
          Height = 354
          Align = alClient
          ItemHeight = 13
          Items.Strings = (
            'one'
            'two'
            'three')
          TabOrder = 0
        end
      end
    end
  end
end
EditForm.dfm
object Form2: TForm2
  Left = 192
  Top = 107
  Width = 382
  Height = 247
  Caption = 'Small Editor'
  Color = clBtnFace
  DragKind = dkDock
  DragMode = dmAutomatic
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Visible = True
  PixelsPerInch = 96
  TextHeight = 13
  object Memo1: TMemo
    Left = 0
    Top = 0
    Width = 374
    Height = 220
    Align = alClient
    Lines.Strings = (
      'Memo1')
    TabOrder = 0
  end
end
CalForm.dfm
object Form3: TForm3
  Left = 280
  Top = 139
  Width = 195
  Height = 333
  Caption = 'Calendar'
  Color = clBtnFace
  DragKind = dkDock
  DragMode = dmAutomatic
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Visible = True
  PixelsPerInch = 96
  TextHeight = 13
  object MonthCalendar1: TMonthCalendar
    Left = 0
    Top = 0
    Width = 187
    Height = 306
    Align = alClient
    AutoSize = True
    Date = 35986.3429524306
    TabOrder = 0
  end
end