From a10b18b3ee0948ae0cbc4d10e8d74d82e15c0112 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 17 Apr 2007 23:26:16 +0000 Subject: * Applied TFEdit patch from Maciej Kaczkowski enabling the text to scroll. Also implemented BorderStyle property. * I made minor changes to Maciej patch. * Updated the WidgetTest demo to showcase the new features. --- examples/gui/widgettest/editform.frm | 159 ++++++++++++++++++--------------- examples/gui/widgettest/widgettest.lpi | 7 +- examples/gui/widgettest/widgettest.pas | 18 ++++ 3 files changed, 107 insertions(+), 77 deletions(-) (limited to 'examples/gui') diff --git a/examples/gui/widgettest/editform.frm b/examples/gui/widgettest/editform.frm index d3c9130c..9051a927 100644 --- a/examples/gui/widgettest/editform.frm +++ b/examples/gui/widgettest/editform.frm @@ -1,74 +1,85 @@ -object EditForm: TEditForm - BorderWidth = 8 - Text = 'Edit field test' - object Grid: TFGridLayout - ColCount = 3 - RowCount = 4 - GridPositions = < - item - Widget = Label1 - end - item - x = 1 - Widget = Edit1 - end - item - x = 2 - Widget = GrayCheckBox1 - end - item - y = 1 - width = 3 - Widget = Separator - end - item - y = 2 - Widget = Label2 - end - item - x = 1 - y = 2 - Widget = Edit2 - end - item - x = 2 - y = 2 - Widget = GrayCheckBox2 - end - item - x = 1 - y = 3 - Widget = PasswordDisplay - end> - object Label1: TFLabel - Text = 'Normal edit field:' - CanExpandWidth = False - end - object Edit1: TFEdit - Text = 'Edit1' - end - object GrayCheckBox1: TFCheckBox - Text = 'Disabled' - OnClick = GrayCheckBox1Click - end - object Separator: TSeparator - end - object Label2: TFLabel - Text = 'Password edit field:' - CanExpandWidth = False - end - object Edit2: TFEdit - PasswordChar = '*' - Text = 'Edit2' - OnChange = Edit2Change - end - object GrayCheckBox2: TFCheckBox - Text = 'Disabled' - OnClick = GrayCheckBox2Click - end - object PasswordDisplay: TFLabel - Text = '(Password field)' - CanExpandWidth = False - end - end -end +object EditForm: TEditForm + BorderWidth = 8 + Text = 'Edit field test' + object Grid: TFGridLayout + ColCount = 3 + RowCount = 5 + GridPositions = < + item + Widget = Label1 + end + item + x = 1 + Widget = Edit1 + end + item + x = 2 + Widget = GrayCheckBox1 + end + item + y = 1 + width = 3 + Widget = Separator + end + item + y = 2 + Widget = Label2 + end + item + x = 1 + y = 2 + Widget = Edit2 + end + item + x = 2 + y = 2 + Widget = GrayCheckBox2 + end + item + x = 1 + y = 3 + Widget = PasswordDisplay + end + item + Widget = cbBorderStyle + x = 0 + y = 4 + Width = 3 + Height = 1 + end> + object Label1: TFLabel + Text = 'Normal edit field:' + CanExpandWidth = False + end + object Edit1: TFEdit + Text = 'Edit1' + end + object GrayCheckBox1: TFCheckBox + Text = 'Disabled' + OnClick = GrayCheckBox1Click + end + object Separator: TSeparator + end + object Label2: TFLabel + Text = 'Password edit field:' + CanExpandWidth = False + end + object Edit2: TFEdit + PasswordChar = '*' + Text = 'Edit2' + OnChange = Edit2Change + end + object GrayCheckBox2: TFCheckBox + Text = 'Disabled' + OnClick = GrayCheckBox2Click + end + object PasswordDisplay: TFLabel + Text = '(Password field)' + CanExpandWidth = False + end + object cbBorderStyle: TFButton + Text = 'Alternate Border Style' + OnClick = cbBorderStyleClick + end + end +end \ No newline at end of file diff --git a/examples/gui/widgettest/widgettest.lpi b/examples/gui/widgettest/widgettest.lpi index be425d5c..711d2936 100644 --- a/examples/gui/widgettest/widgettest.lpi +++ b/examples/gui/widgettest/widgettest.lpi @@ -1,7 +1,7 @@ - + @@ -9,7 +9,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -39,6 +39,7 @@ + diff --git a/examples/gui/widgettest/widgettest.pas b/examples/gui/widgettest/widgettest.pas index a7a3dd93..8dea18a2 100644 --- a/examples/gui/widgettest/widgettest.pas +++ b/examples/gui/widgettest/widgettest.pas @@ -112,6 +112,8 @@ type end; + { TEditForm } + TEditForm = class(TTestForm) Grid: TFGridLayout; VertBox, HorzBox1, HorzBox2: TFBoxLayout; @@ -119,8 +121,10 @@ type Edit1, Edit2: TFEdit; GrayCheckBox1, GrayCheckBox2: TFCheckbox; Separator: TSeparator; + cbBorderStyle: TFButton; procedure GrayCheckBox1Click(Sender: TObject); procedure GrayCheckBox2Click(Sender: TObject); + procedure cbBorderStyleClick(Sender: TObject); procedure Edit2Change(Sender: TObject); public constructor Create(AOwner: TComponent); override; @@ -653,6 +657,20 @@ begin Edit2.Enabled := not GrayCheckBox2.Checked; end; +procedure TEditForm.cbBorderStyleClick(Sender: TObject); +begin + if Edit1.BorderStyle = bsNone then + begin + Edit1.BorderStyle := bsSingle; + Edit2.BorderStyle := bsSingle; + end + else + begin + Edit1.BorderStyle := bsNone; + Edit2.BorderStyle := bsNone; + end; +end; + procedure TEditForm.Edit2Change(Sender: TObject); begin -- cgit v1.2.3-70-g09d2