test for RxDBColorBox

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1620 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2011-05-09 10:41:53 +00:00
parent 48c80f43c5
commit a5ce1a2202
6 changed files with 432 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,115 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="4">
<Item1>
<PackageName Value="LCLBase"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item2>
<Item3>
<PackageName Value="rxnew"/>
<MinVersion Major="2" Minor="1" Release="2" Build="105" Valid="True"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="24"/>
<CursorPos X="50" Y="52"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
</Units>
<JumpHistory Count="2" HistoryIndex="1">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="45" Column="16" TopLine="19"/>
</Position2>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,21 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, rxnew, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

View File

@@ -0,0 +1,239 @@
object Form1: TForm1
Left = 390
Height = 454
Top = 236
Width = 930
Caption = 'Form1'
ClientHeight = 454
ClientWidth = 930
OnCreate = FormCreate
LCLVersion = '0.9.31'
object RxDBGrid1: TRxDBGrid
AnchorSideTop.Control = DBNavigator1
AnchorSideTop.Side = asrBottom
Left = 0
Height = 346
Top = 108
Width = 930
TitleButtons = False
AutoSort = True
Columns = <
item
Title.Alignment = taCenter
Title.Caption = 'FIELD_ID'
Title.Orientation = toHorizontal
Width = 100
FieldName = 'FIELD_ID'
Filter.Font.Style = [fsItalic]
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
end
item
Title.Alignment = taCenter
Title.Caption = 'COLOR_INT'
Title.Orientation = toHorizontal
Width = 150
FieldName = 'COLOR_INT'
Filter.Font.Style = [fsItalic]
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
end
item
Title.Alignment = taCenter
Title.Caption = 'COLOR_STR'
Title.Orientation = toHorizontal
Width = 500
FieldName = 'COLOR_STR'
Filter.Font.Style = [fsItalic]
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
end>
KeyStrokes = <
item
Command = rxgcShowFindDlg
ShortCut = 16454
Enabled = True
end
item
Command = rxgcShowColumnsDlg
ShortCut = 16471
Enabled = True
end
item
Command = rxgcShowFilterDlg
ShortCut = 16468
Enabled = True
end
item
Command = rxgcShowSortDlg
ShortCut = 16467
Enabled = True
end
item
Command = rxgcShowQuickFilter
ShortCut = 16465
Enabled = True
end
item
Command = rxgcHideQuickFilter
ShortCut = 16456
Enabled = True
end>
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter]
FooterColor = clYellow
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
Color = clWindow
DrawFullLine = False
FocusColor = clRed
SelectedColor = clHighlight
GridLineStyle = psSolid
DataSource = Datasource1
Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColumnMove, dgColLines, dgRowLines, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
ParentColor = False
ReadOnly = True
TabOrder = 0
end
object RxDBColorBox1: TRxDBColorBox
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Label2
Left = 12
Height = 29
Top = 30
Width = 385
DataField = 'COLOR_INT'
DataSource = Datasource1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ItemHeight = 0
TabOrder = 1
end
object RxDBColorBox2: TRxDBColorBox
AnchorSideLeft.Control = Label2
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 409
Height = 29
Top = 30
Width = 515
DataField = 'COLOR_STR'
DataSource = Datasource1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ItemHeight = 0
TabOrder = 2
end
object DBNavigator1: TDBNavigator
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = RxDBColorBox1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 25
Top = 77
Width = 241
BevelOuter = bvNone
BorderSpacing.Top = 12
BorderSpacing.Around = 6
ChildSizing.EnlargeHorizontal = crsScaleChilds
ChildSizing.EnlargeVertical = crsScaleChilds
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 100
ClientHeight = 25
ClientWidth = 241
TabOrder = 3
end
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 6
Height = 18
Top = 6
Width = 133
BorderSpacing.Around = 6
Caption = 'Test for integer field'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
Left = 403
Height = 18
Top = 6
Width = 124
BorderSpacing.Around = 6
Caption = 'Test for string field'
ParentColor = False
end
object RxMemoryData1: TRxMemoryData
FieldDefs = <
item
Name = 'FIELD_ID'
DataType = ftAutoInc
Precision = 0
Size = 0
end
item
Name = 'COLOR_STR'
DataType = ftString
Precision = 0
Size = 50
end
item
Name = 'COLOR_INT'
DataType = ftInteger
Precision = 0
Size = 0
end>
left = 368
top = 160
object RxMemoryData1FIELD_ID: TAutoIncField
DisplayWidth = 10
FieldKind = fkData
FieldName = 'FIELD_ID'
Index = 0
LookupCache = False
ProviderFlags = [pfInWhere]
ReadOnly = False
Required = False
end
object RxMemoryData1COLOR_STR: TStringField
DisplayWidth = 50
FieldKind = fkData
FieldName = 'COLOR_STR'
Index = 1
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
Size = 50
end
object RxMemoryData1COLOR_INT: TLongintField
DisplayWidth = 10
FieldKind = fkData
FieldName = 'COLOR_INT'
Index = 2
LookupCache = False
ProviderFlags = [pfInUpdate, pfInWhere]
ReadOnly = False
Required = False
end
end
object Datasource1: TDatasource
DataSet = RxMemoryData1
left = 336
top = 160
end
end

View File

@@ -0,0 +1,57 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, DbCtrls,
StdCtrls, db, rxmemds, rxdbgrid, RxDBColorBox;
type
{ TForm1 }
TForm1 = class(TForm)
Datasource1: TDatasource;
DBNavigator1: TDBNavigator;
Label1: TLabel;
Label2: TLabel;
RxDBColorBox1: TRxDBColorBox;
RxDBColorBox2: TRxDBColorBox;
RxDBGrid1: TRxDBGrid;
RxMemoryData1: TRxMemoryData;
RxMemoryData1COLOR_INT: TLongintField;
RxMemoryData1COLOR_STR: TStringField;
RxMemoryData1FIELD_ID: TAutoIncField;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
RxMemoryData1.Open;
RxMemoryData1.Append;
RxMemoryData1COLOR_STR.AsString:='clWhite';
RxMemoryData1COLOR_INT.AsInteger:=Integer(clGreen);
RxMemoryData1.Post;
RxMemoryData1.Append;
RxMemoryData1COLOR_STR.AsString:='clGreen';
RxMemoryData1COLOR_INT.AsInteger:=Integer(clRed);
RxMemoryData1.Post;
end;
end.