From 9e673aa6cf5df640503af325550604fdc6a7c47f Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Fri, 4 Nov 2011 07:38:22 +0000 Subject: [PATCH] customdrawn test: Adds OnClick handler and logger git-svn-id: trunk@33278 - --- test/customdrawn/mainform.lfm | 93 ++++++++++++++++++++--------------- test/customdrawn/mainform.pas | 10 +++- 2 files changed, 62 insertions(+), 41 deletions(-) diff --git a/test/customdrawn/mainform.lfm b/test/customdrawn/mainform.lfm index 7f27a4e740..cf69a00eeb 100644 --- a/test/customdrawn/mainform.lfm +++ b/test/customdrawn/mainform.lfm @@ -1,18 +1,18 @@ object Form1: TForm1 Left = 332 - Height = 397 - Top = 177 - Width = 458 - Caption = 'Form1' - ClientHeight = 397 - ClientWidth = 458 + Height = 496 + Top = 144 + Width = 459 + Caption = 'Custom Drawn Controls Tester' + ClientHeight = 496 + ClientWidth = 459 LCLVersion = '0.9.31' object comboControls: TComboBox Left = 80 Height = 21 Top = 12 Width = 172 - ItemHeight = 13 + ItemHeight = 0 ItemIndex = 0 Items.Strings = ( 'TCDButton' @@ -39,7 +39,7 @@ object Form1: TForm1 Height = 240 Top = 40 Width = 439 - PageIndex = 5 + PageIndex = 0 TabOrder = 2 TabStop = True object pageButtons: TPage @@ -53,7 +53,8 @@ object Form1: TForm1 Caption = 'dsCommon' Color = 15857141 DrawStyle = dsCommon - TabOrder = 0 + OnClick = HandleClick + TabOrder = 1 TabStop = True end object CDButton2: TCDButton @@ -64,7 +65,8 @@ object Form1: TForm1 Caption = 'dsWinCE' Color = 15857141 DrawStyle = dsWinCE - TabOrder = 1 + OnClick = HandleClick + TabOrder = 2 TabStop = True end object Button1: TButton @@ -73,7 +75,8 @@ object Form1: TForm1 Top = 16 Width = 75 Caption = 'TButton' - TabOrder = 2 + OnClick = HandleClick + TabOrder = 0 end object CDButton3: TCDButton Left = 119 @@ -83,6 +86,7 @@ object Form1: TForm1 Caption = 'dsWin2000' Color = 15857141 DrawStyle = dsWin2000 + OnClick = HandleClick TabOrder = 3 TabStop = True end @@ -94,22 +98,25 @@ object Form1: TForm1 Caption = 'dsWinXP' Color = 15857141 DrawStyle = dsWinXP + OnClick = HandleClick TabOrder = 4 TabStop = True end end object pageEdits: TPage - ClientWidth = 14048 - ClientHeight = 7680 + ClientWidth = 439 + ClientHeight = 240 object CDEdit1: TCDEdit - Left = 103 - Height = 30 - Top = 24 - Width = 100 + Left = 119 + Height = 24 + Top = 26 + Width = 88 + DrawStyle = dsCommon + Text = 'dsCommon' end object Edit1: TEdit Left = 8 - Height = 21 + Height = 22 Top = 28 Width = 80 TabOrder = 1 @@ -117,36 +124,36 @@ object Form1: TForm1 end end object pageCheckboxes: TPage - ClientWidth = 7024 - ClientHeight = 3840 + ClientWidth = 439 + ClientHeight = 240 object CheckBox1: TCheckBox Left = 20 - Height = 17 + Height = 18 Top = 29 - Width = 71 + Width = 91 Caption = 'CheckBox1' TabOrder = 0 end object CDCheckBox1: TCDCheckBox Left = 119 - Height = 16 + Height = 19 Top = 29 - Width = 73 + Width = 93 DrawStyle = dsCommon Caption = 'dsCommon' end object CDCheckBox2: TCDCheckBox Left = 119 - Height = 16 - Top = 47 - Width = 63 + Height = 19 + Top = 48 + Width = 75 DrawStyle = dsWinCE Caption = 'dsWinCE' end end object pageGroupBoxes: TPage - ClientWidth = 14048 - ClientHeight = 7680 + ClientWidth = 56192 + ClientHeight = 30720 object GroupBox1: TGroupBox Left = -1 Height = 105 @@ -207,14 +214,15 @@ object Form1: TForm1 end end object pageTrackBars: TPage - ClientWidth = 14048 - ClientHeight = 7680 + ClientWidth = 439 + ClientHeight = 240 object TrackBar1: TTrackBar Left = 7 Height = 25 Top = 16 Width = 100 Position = 0 + OnClick = HandleClick TabOrder = 0 end object CDTrackBar1: TCDTrackBar @@ -329,17 +337,24 @@ object Form1: TForm1 end end end - object Page7: TPage + object pageTabControls: TPage end end - object Memo1: TMemo - Left = 9 - Height = 90 + object memoLog: TMemo + AnchorSideLeft.Control = Owner + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 7 + Height = 186 Top = 303 - Width = 439 - Lines.Strings = ( - 'Memo1' - ) + Width = 445 + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Left = 7 + BorderSpacing.Right = 7 + BorderSpacing.Bottom = 7 + ScrollBars = ssVertical TabOrder = 3 end object StaticText2: TStaticText diff --git a/test/customdrawn/mainform.pas b/test/customdrawn/mainform.pas index e51408f44f..73c05ecacc 100644 --- a/test/customdrawn/mainform.pas +++ b/test/customdrawn/mainform.pas @@ -38,7 +38,7 @@ type GroupBox1: TGroupBox; Label1: TLabel; Label2: TLabel; - Memo1: TMemo; + memoLog: TMemo; notebookControls: TNotebook; pageButtons: TPage; PageControl1: TPageControl; @@ -47,7 +47,7 @@ type pageGroupBoxes: TPage; pageTrackBars: TPage; pagePageControls: TPage; - Page7: TPage; + pageTabControls: TPage; StaticText1: TStaticText; StaticText2: TStaticText; StaticText3: TStaticText; @@ -58,6 +58,7 @@ type TrackBar1: TTrackBar; CDTrackBar1: TCDTrackBar; procedure comboControlsChange(Sender: TObject); + procedure HandleClick(Sender: TObject); private { private declarations } public @@ -78,5 +79,10 @@ begin notebookControls.PageIndex := comboControls.ItemIndex; end; +procedure TForm1.HandleClick(Sender: TObject); +begin + memoLog.Lines.Add(Format('%s: %s OnClick', [TControl(Sender).Name, TControl(Sender).ClassName])); +end; + end.