Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

View File

@@ -0,0 +1,302 @@
object Form1: TForm1
Left = 502
Height = 397
Top = 390
Width = 590
Caption = 'Form1'
ClientHeight = 397
ClientWidth = 590
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
object PageControl1: TPageControl
Left = 0
Height = 397
Top = 0
Width = 590
ActivePage = TabSheet3
Align = alClient
TabIndex = 2
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'RxDBDateEdit demo'
ClientHeight = 366
ClientWidth = 580
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
Height = 17
Top = 6
Width = 38
Caption = 'Label1'
ParentColor = False
end
object RxDBDateEdit1: TRxDBDateEdit
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
Left = 12
Height = 34
Top = 32
Width = 151
BorderSpacing.Around = 6
ButtonWidth = 23
Enabled = False
MaxLength = 10
PasswordChar = #0
PopupColor = clWindow
TabOrder = 0
Text = 't1. . '
DataField = 'DOC_DATE'
DataSource = dsData
end
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = RxDBDateEdit1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 75
Width = 77
BorderSpacing.Around = 6
Caption = 'Currency edit'
ParentColor = False
end
object CurrencyEdit1: TCurrencyEdit
AnchorSideLeft.Control = Label2
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
Left = 12
Height = 34
Top = 101
Width = 148
Alignment = taCenter
BorderSpacing.Around = 6
TabOrder = 1
end
object RxDateEdit1: TRxDateEdit
Left = 12
Height = 34
Top = 160
Width = 80
ButtonWidth = 23
MaxLength = 10
PasswordChar = #0
PopupColor = clWindow
TabOrder = 2
Text = ' . . '
end
object Button1: TButton
Left = 248
Height = 33
Top = 80
Width = 69
AutoSize = True
Caption = 'Invalidate'
OnClick = Button1Click
TabOrder = 3
end
end
object TabSheet2: TTabSheet
Caption = 'RxDateRangeEdit demo'
ClientHeight = 366
ClientWidth = 580
object CheckBox1: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = TabSheet2
Left = 6
Height = 23
Top = 6
Width = 84
BorderSpacing.Around = 6
Caption = 'reoMonth'
Checked = True
OnChange = CheckBox1Change
State = cbChecked
TabOrder = 0
end
object RxDateRangeEdit1: TRxDateRangeEdit
AnchorSideLeft.Control = TabSheet2
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = CheckBox3
AnchorSideTop.Side = asrBottom
Left = 159
Height = 34
Top = 93
Width = 262
BorderSpacing.Around = 6
Month = 5
TabOrder = 1
Year = 2017
OnChange = RxDateRangeEdit1Change
end
object CheckBox2: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = CheckBox1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 35
Width = 91
BorderSpacing.Around = 6
Caption = 'reoQuarter'
Checked = True
OnChange = CheckBox1Change
State = cbChecked
TabOrder = 2
end
object CheckBox3: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = CheckBox2
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 64
Width = 95
BorderSpacing.Around = 6
Caption = 'reoHalfYear'
Checked = True
OnChange = CheckBox1Change
State = cbChecked
TabOrder = 3
end
object Label3: TLabel
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = RxDateRangeEdit1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 133
Width = 87
BorderSpacing.Around = 6
Caption = 'Start of period'
ParentColor = False
end
object Edit1: TEdit
AnchorSideLeft.Control = Label3
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Label5
Left = 12
Height = 34
Top = 156
Width = 272
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ReadOnly = True
TabOrder = 4
Text = 'Edit1'
end
object Label4: TLabel
AnchorSideLeft.Control = Label5
AnchorSideTop.Control = RxDateRangeEdit1
AnchorSideTop.Side = asrBottom
Left = 296
Height = 17
Top = 133
Width = 79
BorderSpacing.Around = 6
Caption = 'End of period'
ParentColor = False
end
object Edit2: TEdit
AnchorSideLeft.Control = Label4
AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TabSheet2
AnchorSideRight.Side = asrBottom
Left = 302
Height = 34
Top = 156
Width = 272
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ReadOnly = True
TabOrder = 5
Text = 'Edit2'
end
object Label5: TLabel
AnchorSideLeft.Control = TabSheet2
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = TabSheet2
Left = 290
Height = 1
Top = 0
Width = 1
ParentColor = False
end
end
object TabSheet3: TTabSheet
Caption = 'RxTimeEdit demo'
ClientHeight = 366
ClientWidth = 580
object Label6: TLabel
AnchorSideLeft.Control = TabSheet3
AnchorSideTop.Control = TabSheet3
Left = 6
Height = 17
Top = 6
Width = 65
BorderSpacing.Around = 6
Caption = 'RxTimeEdit'
ParentColor = False
end
object CheckBox4: TCheckBox
AnchorSideLeft.Control = RxTimeEdit1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RxTimeEdit1
Left = 154
Height = 23
Top = 35
Width = 104
BorderSpacing.Left = 32
BorderSpacing.Around = 6
Caption = 'Show second'
Checked = True
OnChange = CheckBox4Change
State = cbChecked
TabOrder = 0
end
object RxTimeEdit1: TRxTimeEdit
AnchorSideLeft.Control = Label6
AnchorSideTop.Control = Label6
AnchorSideTop.Side = asrBottom
Left = 12
Height = 34
Top = 29
Width = 104
ShowSecond = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
CharCase = ecNormal
MaxLength = 8
TabOrder = 1
end
end
end
object dsData: TDataSource
DataSet = rxData
Left = 264
Top = 21
end
object rxData: TRxMemoryData
FieldDefs = <
item
Name = 'DOC_DATE'
DataType = ftDate
end>
PacketRecords = 0
Left = 304
Top = 21
object rxDataDOC_DATE: TDateField
DisplayWidth = 10
FieldKind = fkData
FieldName = 'DOC_DATE'
Index = 0
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
end
end
end

View File

@@ -0,0 +1,319 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="22">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="33"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<CursorPos X="6" Y="27"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<ComponentName Value="RxDBGrid_PopUpFilterForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RxDBGrid_PopUpFilterUnit"/>
<EditorIndex Value="-1"/>
<TopLine Value="188"/>
<CursorPos X="60" Y="188"/>
<UsageCount Value="33"/>
</Unit2>
<Unit3>
<Filename Value="../../../../lcl/forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="-1"/>
<TopLine Value="730"/>
<CursorPos Y="748"/>
<UsageCount Value="9"/>
</Unit3>
<Unit4>
<Filename Value="../../rxdb/rxdbgrid.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="581"/>
<CursorPos X="15" Y="599"/>
<UsageCount Value="15"/>
<Bookmarks Count="4">
<Item0 X="14" Y="6403" ID="3"/>
<Item1 X="24" Y="5184" ID="4"/>
<Item2 Y="4864" ID="1"/>
<Item3 Y="4287" ID="2"/>
</Bookmarks>
</Unit4>
<Unit5>
<Filename Value="../../../lazcontrols/listfilteredit.pas"/>
<UnitName Value="ListFilterEdit"/>
<EditorIndex Value="-1"/>
<TopLine Value="307"/>
<CursorPos X="3" Y="311"/>
<UsageCount Value="9"/>
</Unit5>
<Unit6>
<Filename Value="../../rxdb/rxfilterby.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="322"/>
<CursorPos X="3" Y="235"/>
<UsageCount Value="14"/>
</Unit6>
<Unit7>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/db.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1799"/>
<CursorPos X="14" Y="1726"/>
<UsageCount Value="11"/>
</Unit7>
<Unit8>
<Filename Value="../../rxdb/rxmemds.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="819"/>
<CursorPos Y="843"/>
<UsageCount Value="11"/>
</Unit8>
<Unit9>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/dataset.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="842"/>
<CursorPos X="3" Y="845"/>
<UsageCount Value="11"/>
</Unit9>
<Unit10>
<Filename Value="../../rxdb/rxdbgrid_findunit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="93"/>
<CursorPos X="3" Y="95"/>
<UsageCount Value="10"/>
</Unit10>
<Unit11>
<Filename Value="../../rxtools/rxdconst.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="226"/>
<CursorPos X="3" Y="239"/>
<UsageCount Value="11"/>
</Unit11>
<Unit12>
<Filename Value="../../../../lcl/controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="-1"/>
<TopLine Value="2152"/>
<CursorPos X="14" Y="2168"/>
<UsageCount Value="10"/>
</Unit12>
<Unit13>
<Filename Value="../../../../lcl/buttons.pp"/>
<UnitName Value="Buttons"/>
<EditorIndex Value="-1"/>
<TopLine Value="352"/>
<CursorPos X="3" Y="354"/>
<UsageCount Value="10"/>
</Unit13>
<Unit14>
<Filename Value="../../../../lcl/lcltype.pp"/>
<UnitName Value="LCLType"/>
<EditorIndex Value="-1"/>
<TopLine Value="73"/>
<CursorPos X="3" Y="90"/>
<UsageCount Value="10"/>
</Unit14>
<Unit15>
<Filename Value="../../../../lcl/include/customform.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="131"/>
<CursorPos Y="154"/>
<UsageCount Value="10"/>
</Unit15>
<Unit16>
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/types.pp"/>
<UnitName Value="Types"/>
<EditorIndex Value="-1"/>
<TopLine Value="305"/>
<CursorPos X="10" Y="322"/>
<UsageCount Value="10"/>
</Unit16>
<Unit17>
<Filename Value="../../../../lcl/grids.pas"/>
<UnitName Value="Grids"/>
<EditorIndex Value="-1"/>
<TopLine Value="5387"/>
<CursorPos X="3" Y="5392"/>
<UsageCount Value="10"/>
</Unit17>
<Unit18>
<Filename Value="../../../../lcl/dbgrids.pas"/>
<UnitName Value="DBGrids"/>
<EditorIndex Value="-1"/>
<UsageCount Value="10"/>
</Unit18>
<Unit19>
<Filename Value="/home/install/source/fpcsrc/rtl/inc/typshrdh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="93"/>
<CursorPos X="29" Y="158"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="6203"/>
<CursorPos X="38" Y="6234"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<ComponentName Value="rxFilterByForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="340"/>
<CursorPos Y="370"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit21>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="245" Column="3" TopLine="245"/>
</Position1>
<Position2>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="246" Column="3" TopLine="246"/>
</Position2>
<Position3>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="245" Column="3" TopLine="245"/>
</Position3>
<Position4>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="246" Column="3" TopLine="246"/>
</Position4>
<Position5>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="245" Column="3" TopLine="245"/>
</Position5>
<Position6>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="246" Column="3" TopLine="246"/>
</Position6>
<Position7>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="245" Column="3" TopLine="245"/>
</Position7>
<Position8>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="246" Column="3" TopLine="246"/>
</Position8>
<Position9>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="245" Column="3" TopLine="245"/>
</Position9>
<Position10>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="246" Column="3" TopLine="246"/>
</Position10>
<Position11>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="245" Column="3" TopLine="245"/>
</Position11>
<Position12>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="256" Column="45" TopLine="246"/>
</Position12>
<Position13>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="255" Column="45" TopLine="245"/>
</Position13>
<Position14>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="279" Column="20" TopLine="279"/>
</Position14>
<Position15>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="105" Column="15" TopLine="87"/>
</Position15>
<Position16>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="186" Column="3" TopLine="181"/>
</Position16>
<Position17>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="105" Column="5" TopLine="87"/>
</Position17>
<Position18>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="197" Column="17" TopLine="178"/>
</Position18>
<Position19>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="198" TopLine="177"/>
</Position19>
<Position20>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="384" Column="27" TopLine="363"/>
</Position20>
<Position21>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="107" Column="14" TopLine="89"/>
</Position21>
<Position22>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="235" Column="30" TopLine="217"/>
</Position22>
<Position23>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="109" Column="15" TopLine="87"/>
</Position23>
<Position24>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="105" Column="15" TopLine="87"/>
</Position24>
<Position25>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="197" Column="33" TopLine="181"/>
</Position25>
<Position26>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="109" Column="15" TopLine="87"/>
</Position26>
<Position27>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="351" Column="11" TopLine="332"/>
</Position27>
<Position28>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="354" Column="70" TopLine="337"/>
</Position28>
<Position29>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="353" TopLine="337"/>
</Position29>
<Position30>
<Filename Value="../../../rxdb/rxfilterby.pas"/>
<Caret Line="354" TopLine="337"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode="default"/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions><package name="rx_sort_zeos"><module name="exsortzeos"><short>Модуль содержит класс для сортировки данных, предоставляемых библиотекой ZEOS в RxDBGrid</short><element name="TZeosDataSetSortEngine"><short>Класс сортировки данных</short>
</element><element name="TZeosDataSetSortEngine.Sort"><short>Сортировка по одному полю</short>
</element><element name="TZeosDataSetSortEngine.SortList"><short>Сортировка по нескольким полям</short>
</element>
</module>
</package>
</fpdoc-descriptions>

View File

@@ -0,0 +1,363 @@
{ RxDBColorBox unit
Copyright (C) 2005-2017 Lagunov Aleksey alexs@yandex.ru and Lazarus team
original conception from rx library for Delphi (c)
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit RxDBColorBox;
{$I rx.inc}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ColorBox,
DbCtrls, DB, LMessages, LCLType;
type
{ TRxCustomDBColorBox }
TRxCustomDBColorBox = class(TCustomColorBox)
FDataLink: TFieldDataLink;
procedure DataChange(Sender: TObject);
function GetDataField: string;
function GetDataSource: TDataSource;
function GetField: TField;
function GetReadOnly: Boolean;
procedure SetDataField(const AValue: string);
procedure SetDataSource(const AValue: TDataSource);
procedure SetReadOnly(const AValue: Boolean);
procedure UpdateData(Sender: TObject);
procedure FocusRequest(Sender: TObject);
procedure ActiveChange(Sender: TObject);
procedure LayoutChange(Sender: TObject);
procedure CMGetDataLink(var Message: TLMessage); message CM_GETDATALINK;
function IsReadOnly: boolean;
protected
property DataField: string read GetDataField write SetDataField;
property DataSource: TDataSource read GetDataSource write SetDataSource;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure Change; override;
procedure Loaded; override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Field: TField read GetField;
published
{ Published declarations }
end;
TRxDBColorBox = class(TRxCustomDBColorBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
property DataField;
property DataSource;
property ReadOnly;
property DefaultColorColor;
property NoneColorColor;
property Selected;
property Style;
property OnGetColors;
property Align;
property Anchors;
property ArrowKeysTraverseList;
property AutoComplete;
property AutoCompleteText;
property AutoDropDown;
property AutoSelect;
property AutoSize;
property BidiMode;
property BorderSpacing;
property Color;
property Constraints;
property DragCursor;
property DragMode;
property DropDownCount;
property Enabled;
property Font;
property ItemHeight;
property ItemWidth;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnCloseUp;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnDropDown;
property OnEditingDone;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnStartDrag;
property OnSelect;
property OnUTF8KeyPress;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
end;
implementation
uses
LCLVersion;
type
TFieldDataLinkHack = class(TFieldDataLink)
end;
{ TRxCustomDBColorBox }
procedure TRxCustomDBColorBox.DataChange(Sender: TObject);
begin
if Assigned(FDataLink.Field) and (FDataLink.Field.DataType in [ftString, ftInteger, ftLargeint]) then
begin
if FDatalink.Field.DataType in [ftString] then
begin
if FDatalink.Field.AsString<>'' then
try
Selected:=StringToColor(FDatalink.Field.AsString)
except
Selected:=clNone;
end
else
Selected:=clNone;
end
else
if FDataLink.Field.DataType in [ftInteger, ftLargeint] then
begin
try
Selected:=TColor(FDatalink.Field.AsInteger);
except
Selected:=clNone;
end;
end;
end
else
begin
Selected := clNone;
end;
end;
function TRxCustomDBColorBox.GetDataField: string;
begin
Result := FDataLink.FieldName;
end;
function TRxCustomDBColorBox.GetDataSource: TDataSource;
begin
Result := FDataLink.DataSource;
end;
function TRxCustomDBColorBox.GetField: TField;
begin
Result := FDataLink.Field;
end;
function TRxCustomDBColorBox.GetReadOnly: Boolean;
begin
Result := FDataLink.ReadOnly;
end;
procedure TRxCustomDBColorBox.SetDataField(const AValue: string);
begin
FDataLink.FieldName := AValue;
end;
procedure TRxCustomDBColorBox.SetDataSource(const AValue: TDataSource);
begin
ChangeDataSource(Self,FDataLink,AValue);
end;
procedure TRxCustomDBColorBox.SetReadOnly(const AValue: Boolean);
begin
inherited;
FDataLink.ReadOnly := AValue;
end;
procedure TRxCustomDBColorBox.UpdateData(Sender: TObject);
begin
if FDataLink.Field.DataType in [ftString] then
FDataLink.Field.AsString := ColorToString(Selected)
else
if FDataLink.Field.DataType in [ftInteger, ftLargeint] then
FDataLink.Field.AsInteger := Integer(Selected);
end;
procedure TRxCustomDBColorBox.FocusRequest(Sender: TObject);
begin
SetFocus;
end;
procedure TRxCustomDBColorBox.ActiveChange(Sender: TObject);
begin
if FDatalink.Active then
DataChange(Sender)
else
begin
Selected := clNone;
FDataLink.Reset;
end;
end;
procedure TRxCustomDBColorBox.LayoutChange(Sender: TObject);
begin
DataChange(Sender);
end;
procedure TRxCustomDBColorBox.CMGetDataLink(var Message: TLMessage);
begin
Message.Result := PtrUInt(FDataLink);
end;
function TRxCustomDBColorBox.IsReadOnly: boolean;
begin
Result := true;
if FDatalink.Active and (not Self.ReadOnly) then
Result := (Field = nil) or Field.ReadOnly;
end;
procedure TRxCustomDBColorBox.KeyDown(var Key: Word; Shift: TShiftState);
begin
inherited KeyDown(Key, Shift);
if Key=VK_ESCAPE then
begin
//cancel out of editing by reset on esc
FDataLink.Reset;
SelectAll;
Key := VK_UNKNOWN;
end
else
if Key=VK_DELETE then
begin
if not IsReadOnly then
FDatalink.Edit;
end
else
if Key=VK_TAB then
begin
if FDataLink.CanModify and FDatalink.Editing then
FDataLink.UpdateRecord;
end;
end;
procedure TRxCustomDBColorBox.Change;
begin
FDatalink.Edit;
FDataLink.Modified;
inherited Change;
end;
procedure TRxCustomDBColorBox.Loaded;
begin
inherited Loaded;
if (csDesigning in ComponentState) then
DataChange(Self);
end;
procedure TRxCustomDBColorBox.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation=opRemove) then
begin
if (FDataLink<>nil) and (AComponent=DataSource) then
DataSource:=nil;
end;
end;
procedure TRxCustomDBColorBox.WMSetFocus(var Message: TLMSetFocus);
begin
inherited WMSetFocus(Message);
if not FDatalink.Editing then
FDatalink.Reset;
end;
procedure TRxCustomDBColorBox.WMKillFocus(var Message: TLMKillFocus);
begin
inherited WMKillFocus(Message);
if not FDatalink.Editing then
FDatalink.Reset
else
TFieldDataLinkHack(FDatalink).UpdateData;
end;
constructor TRxCustomDBColorBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDataLink := TFieldDataLink.Create;
FDataLink.Control := Self;
FDataLink.OnDataChange := @DataChange;
FDataLink.OnUpdateData := @UpdateData;
FDataLink.OnActiveChange := @ActiveChange;
{$if (lcl_major = 0) and (lcl_release <= 30)}
FDataLink.OnLayoutChange := @LayoutChange;
{$endif}
end;
destructor TRxCustomDBColorBox.Destroy;
begin
FreeAndNil(FDataLink);
inherited Destroy;
end;
end.