Project MORE
Project Structure
MORE.DPR
program More;
uses
Forms,
MoreF in 'MoreF.pas' {Form1},
Confdial in 'CONFDIAL.PAS' {ConfigureDialog};
{$R *.RES}
begin
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TConfigureDialog, ConfigureDialog);
Application.Run;
end.
MOREF.PAS
unit MoreF;
interface
uses
Windows, Classes, Graphics, Forms,
Controls, ConfDial, StdCtrls;
type
TForm1 = class(TForm)
ConfigureButton: TButton;
Label1: TLabel;
Label2: TLabel;
procedure ConfigureButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ConfigureButtonClick(Sender: TObject);
begin
ConfigureDialog.CheckBox1.Checked := Label1.Visible;
ConfigureDialog.CheckBox2.Checked := Label2.Visible;
if (fsItalic in Label1.Font.Style) then
ConfigureDialog.ItalicCheckBox.Checked := True
else
ConfigureDialog.ItalicCheckBox.Checked := False;
if (fsBold in Label1.Font.Style) then
ConfigureDialog.BoldCheckBox.Checked := True
else
ConfigureDialog.BoldCheckBox.Checked := False;
if (ConfigureDialog.ShowModal = mrOk) then
begin
Label1.Visible := ConfigureDialog.CheckBox1.Checked;
Label2.Visible := ConfigureDialog.CheckBox2.Checked;
{compute the style of the first label}
if ConfigureDialog.BoldCheckBox.Checked then
Label1.Font.Style := [fsBold]
else
Label1.Font.Style := [];
if ConfigureDialog.ItalicCheckBox.Checked then
Label1.Font.Style := Label1.Font.Style + [fsItalic];
{copy the style to the other label}
Label2.Font.Style := Label1.Font.Style;
end;
end;
end.
CONFDIAL.PAS
unit Confdial;
interface
uses
Windows, Classes, Graphics, Forms,
Controls, Buttons, StdCtrls, ExtCtrls;
type
TConfigureDialog = class(TForm)
btnOK: TBitBtn;
btnCancel: TBitBtn;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
btnMore: TBitBtn;
PanelMore: TPanel;
ItalicCheckBox: TCheckBox;
BoldCheckBox: TCheckBox;
Label1: TLabel;
procedure btnMoreClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
OldHeight, NewHeight: Integer;
end;
var
ConfigureDialog: TConfigureDialog;
implementation
{$R *.DFM}
procedure TConfigureDialog.btnMoreClick(Sender: TObject);
var
I: Integer;
begin
PanelMore.Visible := True;
btnMore.Enabled := False;
for I := ClientHeight to NewHeight do
begin
ClientHeight := I;
Update;
end;
end;
procedure TConfigureDialog.FormCreate(Sender: TObject);
begin
OldHeight := ClientHeight;
// bottom of the panel
NewHeight := PanelMore.Top + PanelMore.Height;
end;
procedure TConfigureDialog.FormActivate(Sender: TObject);
begin
ClientHeight := OldHeight;
btnMore.Enabled := True;
PanelMore.Visible := False;
end;
end.
MOREF.DFM
object Form1: TForm1
Left = 130
Top = 119
Width = 334
Height = 116
ActiveControl = ConfigureButton
Caption = 'Dialog test'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 16
Top = 19
Width = 116
Height = 16
Caption = 'This is the first label'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
end
object Label2: TLabel
Left = 16
Top = 51
Width = 137
Height = 16
Caption = 'This is the second label'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
end
object ConfigureButton: TButton
Left = 232
Top = 30
Width = 81
Height = 25
Caption = '&Configure...'
TabOrder = 0
OnClick = ConfigureButtonClick
end
end
CONFDIAL.DFM
object ConfigureDialog: TConfigureDialog
Left = 240
Top = 251
ActiveControl = CheckBox1
BorderStyle = bsDialog
Caption = 'Choose configuration'
ClientHeight = 106
ClientWidth = 306
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
OnActivate = FormActivate
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object btnOK: TBitBtn
Left = 200
Top = 8
Width = 97
Height = 27
Caption = 'OK'
ModalResult = 1
TabOrder = 3
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
NumGlyphs = 2
end
object btnCancel: TBitBtn
Left = 200
Top = 40
Width = 97
Height = 28
TabOrder = 4
Kind = bkCancel
end
object CheckBox1: TCheckBox
Left = 24
Top = 25
Width = 105
Height = 24
Caption = 'Show &first label'
TabOrder = 0
end
object CheckBox2: TCheckBox
Left = 24
Top = 57
Width = 121
Height = 24
Caption = 'Show &second label'
TabOrder = 1
end
object btnMore: TBitBtn
Left = 200
Top = 72
Width = 97
Height = 28
Caption = '&More >>'
TabOrder = 5
OnClick = btnMoreClick
Glyph.Data = {
F6000000424DF600000000000000760000002800000010000000100000000100
0400000000008000000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF003333333CCC33
3333333333CCCCC3333333333CCCCCCC33333333CCCCCCCCC333333CCC3CCC3C
CC3333CCC33CCC33CCC333CC333CCC333CC333C3333CCC3333C33333333CCC33
33333333333CCC3333333333333CCC3333333333333CCC3333333333333CCC33
33333333333CCC3333333333333CCC3333333333333333333333}
end
object PanelMore: TPanel
Left = 0
Top = 112
Width = 306
Height = 86
BevelOuter = bvNone
TabOrder = 2
object Label1: TLabel
Left = 16
Top = 13
Width = 161
Height = 33
AutoSize = False
Caption = 'Here comes the rest of the dialog box, with some new controls...'
WordWrap = True
end
object ItalicCheckBox: TCheckBox
Left = 17
Top = 45
Width = 65
Height = 25
Caption = '&Italic'
TabOrder = 0
end
object BoldCheckBox: TCheckBox
Left = 105
Top = 45
Width = 81
Height = 25
Caption = '&Bold'
TabOrder = 1
end
end
end
|