RxFPC:patch from Iliya Iliev: 1. TRxDBLookupCombo - added protected method DoSelect - encapsulates OnSelect logic; 2. TRxDBLookupCombo - added public methods Clear & IsEmpty; 3. TRxDBLookupCombo - exposed property BorderStyle (default bsNone). When it's bsNone, nothing changed, while when it's bsSingle there are changes in Painting.; 4. TRxDBLookupCombo - changed method Paint - it respects BorderStyle property; 5. TPopUpFormOptions - added new property SearchFromStart (default false) - when it's false, nothing changed, while when it's true popup form locates the row only if it starts with the searched text.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6102 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2017-12-18 12:45:42 +00:00
parent 991c35d128
commit 01e1bf6975
5 changed files with 241 additions and 73 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="11"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
@@ -22,10 +22,14 @@
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default">
<local>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</Mode0>
</Modes>
</RunParams>
<RequiredPackages Count="3">
<Item1>
@@ -40,7 +44,7 @@
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="9">
<Units Count="11">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
@@ -56,8 +60,8 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="42"/>
<CursorPos Y="47"/>
<TopLine Value="53"/>
<CursorPos X="45" Y="69"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@@ -115,12 +119,55 @@
<CursorPos Y="326"/>
<UsageCount Value="10"/>
</Unit8>
<Unit9>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/db.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="547"/>
<CursorPos X="3" Y="566"/>
<UsageCount Value="10"/>
</Unit9>
<Unit10>
<Filename Value="../../rxdb/rxlookup.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="300"/>
<CursorPos X="3" Y="327"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit10>
</Units>
<JumpHistory Count="1">
<JumpHistory Count="8" HistoryIndex="7">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="47" TopLine="34"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="61" Column="14" TopLine="37"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="25" Column="5" TopLine="9"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="12" Column="37" TopLine="9"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="26" Column="21" TopLine="9"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="27" Column="21" TopLine="9"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="64" Column="43" TopLine="52"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="65" Column="43" TopLine="53"/>
</Position8>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@@ -8,14 +8,15 @@ object Form1: TForm1
ClientHeight = 368
ClientWidth = 498
OnCreate = FormCreate
LCLVersion = '1.7'
LCLVersion = '1.9.0.0'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideTop.Control = GroupBox1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 20
Top = 6
Width = 85
Height = 13
Top = 94
Width = 68
BorderSpacing.Around = 6
Caption = 'Select item...'
ParentColor = False
@@ -25,10 +26,10 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Button1
AnchorSideTop.Side = asrCenter
Left = 106
Height = 20
Top = 78
Width = 42
Left = 97
Height = 13
Top = 149
Width = 35
BorderSpacing.Around = 6
Caption = 'Label2'
ParentColor = False
@@ -40,8 +41,8 @@ object Form1: TForm1
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 12
Height = 32
Top = 32
Height = 25
Top = 113
Width = 480
AutoSize = True
Anchors = [akTop, akLeft, akRight]
@@ -75,9 +76,9 @@ object Form1: TForm1
AnchorSideTop.Control = RxDBLookupCombo1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 36
Top = 70
Width = 94
Height = 23
Top = 144
Width = 85
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Test caption'
@@ -89,10 +90,10 @@ object Form1: TForm1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 424
Height = 36
Top = 112
Width = 68
Left = 427
Height = 23
Top = 173
Width = 65
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Around = 6
@@ -106,25 +107,85 @@ object Form1: TForm1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Button2
Left = 6
Height = 37
Top = 112
Width = 412
Height = 21
Top = 173
Width = 415
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 3
Text = 'Edit1'
end
object DBGrid1: TDBGrid
AnchorSideTop.Control = Edit1
AnchorSideTop.Side = asrBottom
Left = 0
Height = 208
Top = 160
Height = 168
Top = 200
Width = 498
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
Color = clWindow
Columns = <>
DataSource = dsLookUpData
TabOrder = 4
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 82
Top = 6
Width = 486
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'RxDBLookupCombo visual options'
ClientHeight = 64
ClientWidth = 482
TabOrder = 5
object CheckBox1: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = GroupBox1
Left = 6
Height = 17
Top = 6
Width = 38
BorderSpacing.Around = 6
Caption = 'Flat'
OnChange = CheckBox1Change
TabOrder = 0
end
object RadioGroup1: TRadioGroup
AnchorSideLeft.Control = CheckBox1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupBox1
Left = 50
Height = 52
Top = 6
Width = 77
AutoFill = True
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Border style'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 34
ClientWidth = 73
Items.Strings = (
'bsNone'
'bsSingle'
)
OnClick = CheckBox1Change
TabOrder = 1
end
end
object rxData1: TRxMemoryData
FieldDefs = <
item
@@ -132,8 +193,8 @@ object Form1: TForm1
DataType = ftInteger
end>
PacketRecords = 0
left = 320
top = 8
Left = 320
Top = 8
object rxData1ID: TLongintField
DisplayWidth = 10
FieldKind = fkData
@@ -161,8 +222,8 @@ object Form1: TForm1
DataType = ftCurrency
end>
PacketRecords = 0
left = 208
top = 56
Left = 208
Top = 56
object rxLookUpDataID: TLongintField
DisplayWidth = 10
FieldKind = fkData
@@ -200,12 +261,12 @@ object Form1: TForm1
end
object dsData1: TDataSource
DataSet = rxData1
left = 288
top = 8
Left = 288
Top = 8
end
object dsLookUpData: TDataSource
DataSet = rxLookUpData
left = 176
top = 56
Left = 176
Top = 56
end
end

View File

@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, db, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs, StdCtrls, DBGrids, rxlookup, rxmemds;
Dialogs, StdCtrls, DBGrids, ExtCtrls, rxlookup, rxmemds;
type
@@ -15,12 +15,15 @@ type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
CheckBox1: TCheckBox;
DBGrid1: TDBGrid;
dsData1: TDatasource;
dsLookUpData: TDatasource;
Edit1: TEdit;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
RadioGroup1: TRadioGroup;
rxData1ID: TLongintField;
RxDBLookupCombo1: TRxDBLookupCombo;
rxData1: TRxMemoryData;
@@ -30,6 +33,7 @@ type
rxLookUpDataPrice: TCurrencyField;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
@@ -56,6 +60,16 @@ begin
RxDBLookupCombo1.Text:=Edit1.Text;
end;
procedure TForm1.CheckBox1Change(Sender: TObject);
begin
RxDBLookupCombo1.Flat:=CheckBox1.Checked;
case RadioGroup1.ItemIndex of
0:RxDBLookupCombo1.BorderStyle:=bsNone;
1:RxDBLookupCombo1.BorderStyle:=bsSingle;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
rxData1.Open;