You've already forked lazarus-ccr
New components, bug fixes, new example for tjlabel and tjbutton
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2778 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -5,6 +5,9 @@ Note: Lazarus Trunk required
|
||||
|
||||
Version pre-1.1
|
||||
--------------------------------------------------
|
||||
2013-08-29 Added: TJLabel + TJButton example
|
||||
2013-08-28 Fixed: A few bugs in design/runtime mode
|
||||
2013-08-25 Added: New components: TJLabel, TJDBLabel, TJButton.
|
||||
2013-08-18 Added: Calendar to Date/Date Time components and grid controls. Bug fixes
|
||||
2013-06-17 Added: TJDBImageBlob. Display raw images from blob fields (read only)
|
||||
2013-04-29 Fixed: TJDBGridControl Focus issues
|
||||
|
@ -1,18 +1,18 @@
|
||||
object Form1: TForm1
|
||||
Left = 307
|
||||
Height = 331
|
||||
Top = 233
|
||||
Width = 436
|
||||
Left = 576
|
||||
Height = 332
|
||||
Top = 272
|
||||
Width = 366
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 331
|
||||
ClientWidth = 436
|
||||
ClientHeight = 332
|
||||
ClientWidth = 366
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.1'
|
||||
LCLVersion = '0.9.31'
|
||||
object Label1: TLabel
|
||||
Left = 13
|
||||
Height = 17
|
||||
Height = 18
|
||||
Top = 16
|
||||
Width = 149
|
||||
Width = 150
|
||||
Caption = 'Testing jujibo db controls'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -35,9 +35,9 @@ object Form1: TForm1
|
||||
TabOrder = 4
|
||||
end
|
||||
object BitBtn1: TBitBtn
|
||||
Left = 343
|
||||
Left = 273
|
||||
Height = 30
|
||||
Top = 288
|
||||
Top = 289
|
||||
Width = 77
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = '&Cerrar'
|
||||
@ -46,7 +46,7 @@ object Form1: TForm1
|
||||
TabOrder = 5
|
||||
end
|
||||
object JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit
|
||||
Left = 298
|
||||
Left = 272
|
||||
Height = 27
|
||||
Top = 173
|
||||
Width = 80
|
||||
@ -59,9 +59,9 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideRight.Control = JDBLabeledCurrencyEdit1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JDBLabeledCurrencyEdit1
|
||||
EditLabel.Left = 298
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 153
|
||||
EditLabel.Left = 272
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 152
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Total'
|
||||
EditLabel.ParentColor = False
|
||||
@ -80,8 +80,8 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JDBLabeledIntegerEdit1
|
||||
EditLabel.Left = 21
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 154
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 153
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Id'
|
||||
EditLabel.ParentColor = False
|
||||
@ -90,28 +90,24 @@ object Form1: TForm1
|
||||
object JDBLabeledDateEdit1: TJDBLabeledDateEdit
|
||||
Left = 106
|
||||
Height = 27
|
||||
Hint = 'Try Alt+Down arrow key to show the calendar'
|
||||
Top = 173
|
||||
Width = 80
|
||||
DataField = 'DATE'
|
||||
DataSource = Datasource1
|
||||
ButtonWidth = 23
|
||||
EditLabel.AnchorSideLeft.Control = JDBLabeledDateEdit1
|
||||
EditLabel.AnchorSideRight.Control = JDBLabeledDateEdit1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JDBLabeledDateEdit1
|
||||
EditLabel.Left = 106
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 153
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 152
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Date'
|
||||
EditLabel.ParentColor = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
end
|
||||
object JDBLabeledIntegerEdit2: TJDBLabeledIntegerEdit
|
||||
Left = 214
|
||||
Left = 188
|
||||
Height = 27
|
||||
Top = 173
|
||||
Width = 80
|
||||
@ -122,22 +118,47 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideRight.Control = JDBLabeledIntegerEdit2
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JDBLabeledIntegerEdit2
|
||||
EditLabel.Left = 214
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 153
|
||||
EditLabel.Left = 188
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 152
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Id2'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 2
|
||||
end
|
||||
object Datasource1: TDatasource
|
||||
DataSet = BufDataset1
|
||||
left = 336
|
||||
DataSet = MemDataset1
|
||||
left = 224
|
||||
top = 8
|
||||
end
|
||||
object BufDataset1: TBufDataset
|
||||
FieldDefs = <>
|
||||
left = 248
|
||||
object MemDataset1: TMemDataset
|
||||
Active = True
|
||||
FieldDefs = <
|
||||
item
|
||||
Name = 'ID'
|
||||
DataType = ftInteger
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end
|
||||
item
|
||||
Name = 'DATE'
|
||||
DataType = ftDate
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end
|
||||
item
|
||||
Name = 'TOTAL'
|
||||
DataType = ftFloat
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end
|
||||
item
|
||||
Name = 'ID2'
|
||||
DataType = ftInteger
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end>
|
||||
left = 184
|
||||
top = 8
|
||||
end
|
||||
end
|
||||
|
@ -5,9 +5,9 @@ unit main;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, DB, BufDataset, FileUtil, Forms, Controls, Graphics,
|
||||
Dialogs, StdCtrls, DBCtrls, Buttons, jdblabeledcurrencyedit,
|
||||
jdblabeledintegeredit, jdblabeleddateedit;
|
||||
Classes, SysUtils, DB, memds, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, DBCtrls, Buttons, jdblabeledcurrencyedit, jdblabeledintegeredit,
|
||||
jdblabeleddateedit;
|
||||
|
||||
type
|
||||
|
||||
@ -15,7 +15,6 @@ type
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BitBtn1: TBitBtn;
|
||||
BufDataset1: TBufDataset;
|
||||
Datasource1: TDatasource;
|
||||
DBNavigator1: TDBNavigator;
|
||||
JDBLabeledCurrencyEdit1: TJDBLabeledCurrencyEdit;
|
||||
@ -25,6 +24,7 @@ type
|
||||
Label1: TLabel;
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
MemDataset1: TMemDataset;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
@ -45,26 +45,17 @@ procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
// Create BufDataset
|
||||
with BufDataset1.FieldDefs do
|
||||
begin
|
||||
Add('ID', ftInteger, 0, False);
|
||||
Add('DATE', ftDate, 0, False);
|
||||
Add('TOTAL', ftCurrency, 0, False);
|
||||
Add('ID2', ftInteger, 0, False);
|
||||
end;
|
||||
BufDataset1.CreateDataset;
|
||||
// populate the memDataset
|
||||
for i := 1 to 10 do
|
||||
begin
|
||||
BufDataset1.Append;
|
||||
BufDataset1.FieldByName('ID').AsInteger := i;
|
||||
BufDataset1.FieldByName('DATE').AsDateTime := Now;
|
||||
BufDataset1.FieldByName('ID2').AsInteger := i * i;
|
||||
BufDataset1.FieldByName('TOTAL').AsCurrency := i * i * i;
|
||||
BufDataset1.Post;
|
||||
MemDataset1.Append;
|
||||
MemDataset1.FieldByName('ID').AsInteger := i;
|
||||
MemDataset1.FieldByName('DATE').AsDateTime := Now;
|
||||
MemDataset1.FieldByName('ID2').AsInteger := i * i;
|
||||
MemDataset1.FieldByName('TOTAL').AsFloat := i * i * i;
|
||||
MemDataset1.Post;
|
||||
end;
|
||||
BufDataset1.First;
|
||||
MemDataset1.First;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
@ -25,18 +25,22 @@
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<RequiredPackages Count="4">
|
||||
<Item1>
|
||||
<PackageName Value="jujiboutils"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="FCL"/>
|
||||
<PackageName Value="MemDSLaz"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
@ -48,14 +52,13 @@
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="main"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Version Value="10"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
@ -64,6 +67,10 @@
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="True"/>
|
||||
<DebugInfoType Value="dsAuto"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
|
@ -8,7 +8,8 @@ uses
|
||||
{$ENDIF}clocale,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, main;
|
||||
Forms, main, memdslaz
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
@ -1,19 +1,17 @@
|
||||
object Form1: TForm1
|
||||
Left = 365
|
||||
Height = 184
|
||||
Hint = 'Try Alt+Down arrow key to show the calendar'
|
||||
Top = 261
|
||||
Width = 445
|
||||
Height = 185
|
||||
Top = 260
|
||||
Width = 419
|
||||
Caption = 'Example'
|
||||
ClientHeight = 184
|
||||
ClientWidth = 445
|
||||
ShowHint = True
|
||||
LCLVersion = '1.1'
|
||||
ClientHeight = 185
|
||||
ClientWidth = 419
|
||||
LCLVersion = '0.9.31'
|
||||
object Label1: TLabel
|
||||
Left = 8
|
||||
Height = 17
|
||||
Height = 18
|
||||
Top = 8
|
||||
Width = 252
|
||||
Width = 253
|
||||
Caption = 'Testing non DB-Aware Input Controls'
|
||||
Font.Height = 14
|
||||
Font.Style = [fsBold]
|
||||
@ -24,10 +22,10 @@ object Form1: TForm1
|
||||
Left = 24
|
||||
Height = 82
|
||||
Top = 40
|
||||
Width = 400
|
||||
Width = 375
|
||||
Caption = 'Labeled controls'
|
||||
ClientHeight = 63
|
||||
ClientWidth = 396
|
||||
ClientWidth = 371
|
||||
TabOrder = 0
|
||||
object JLabeledIntegerEdit1: TJLabeledIntegerEdit
|
||||
Left = 14
|
||||
@ -41,8 +39,8 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JLabeledIntegerEdit1
|
||||
EditLabel.Left = 14
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 3
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 2
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Integer'
|
||||
EditLabel.ParentColor = False
|
||||
@ -61,8 +59,8 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JLabeledCurrencyEdit1
|
||||
EditLabel.Left = 102
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 3
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 2
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Currency'
|
||||
EditLabel.ParentColor = False
|
||||
@ -71,28 +69,26 @@ object Form1: TForm1
|
||||
object JLabeledDateEdit1: TJLabeledDateEdit
|
||||
Left = 190
|
||||
Height = 27
|
||||
Hint = 'Try Alt+Down Arrow key to show the calendar'
|
||||
Top = 22
|
||||
Width = 80
|
||||
DisplayFormat = 'dd/mm/yy'
|
||||
Value = 0
|
||||
ButtonWidth = 23
|
||||
EditLabel.AnchorSideLeft.Control = JLabeledDateEdit1
|
||||
EditLabel.AnchorSideRight.Control = JLabeledDateEdit1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JLabeledDateEdit1
|
||||
EditLabel.Left = 190
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 2
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 1
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Date'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 2
|
||||
end
|
||||
object JLabeledFloatEdit1: TJLabeledFloatEdit
|
||||
Left = 298
|
||||
Left = 280
|
||||
Height = 27
|
||||
Top = 22
|
||||
Top = 23
|
||||
Width = 80
|
||||
DisplayFormat = '#,0.00'
|
||||
Decimals = 2
|
||||
@ -101,8 +97,8 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideRight.Control = JLabeledFloatEdit1
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = JLabeledFloatEdit1
|
||||
EditLabel.Left = 298
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Left = 280
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 2
|
||||
EditLabel.Width = 80
|
||||
EditLabel.Caption = 'Float'
|
||||
@ -111,9 +107,9 @@ object Form1: TForm1
|
||||
end
|
||||
end
|
||||
object BitBtn1: TBitBtn
|
||||
Left = 334
|
||||
Left = 308
|
||||
Height = 30
|
||||
Top = 138
|
||||
Top = 139
|
||||
Width = 91
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = '&Cerrar'
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
@ -18,13 +18,13 @@
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<DestinationDirectory Value="$(TestDir)/testnodb/"/>
|
||||
<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"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
@ -45,14 +45,13 @@
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="main"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Version Value="10"/>
|
||||
<Target>
|
||||
<Filename Value="testnodb"/>
|
||||
</Target>
|
||||
@ -61,6 +60,10 @@
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="True"/>
|
||||
<DebugInfoType Value="dsAuto"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
|
143
components/jujiboutils/examples/jlabel_button_test/panel.lpi
Normal file
143
components/jujiboutils/examples/jlabel_button_test/panel.lpi
Normal file
@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="panel"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="3">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
<Item2 Name="Windows">
|
||||
<MacroValues Count="1">
|
||||
<Macro1 Name="LCLWidgetType" Value="win32"/>
|
||||
</MacroValues>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="panel"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<TargetOS Value="win32"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
<Item3 Name="Qt4">
|
||||
<MacroValues Count="1">
|
||||
<Macro2 Name="LCLWidgetType" Value="qt"/>
|
||||
</MacroValues>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="panel"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item3>
|
||||
<SharedMatrixOptions Count="2">
|
||||
<Item1 ID="816031965831" Modes="Windows" Type="IDEMacro" MacroName="LCLWidgetType" Value="win32"/>
|
||||
<Item2 ID="040486138318" Modes="Qt4" Type="IDEMacro" MacroName="LCLWidgetType" Value="qt"/>
|
||||
</SharedMatrixOptions>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<DestinationDirectory Value="$(TestDir)/jlabel_button_test/"/>
|
||||
<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="2">
|
||||
<Item1>
|
||||
<PackageName Value="jujiboutils"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="panel.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="panel"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="principal.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="principal"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="panel"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
21
components/jujiboutils/examples/jlabel_button_test/panel.lpr
Normal file
21
components/jujiboutils/examples/jlabel_button_test/panel.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program panel;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, principal
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
1735
components/jujiboutils/examples/jlabel_button_test/principal.lfm
Normal file
1735
components/jujiboutils/examples/jlabel_button_test/principal.lfm
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,77 @@
|
||||
unit principal;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
StdCtrls, JButton, JLabel;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
JButton1: TJButton;
|
||||
JButton10: TJButton;
|
||||
JButton11: TJButton;
|
||||
JButton12: TJButton;
|
||||
JButton14: TJButton;
|
||||
JButton15: TJButton;
|
||||
JButton16: TJButton;
|
||||
JButton17: TJButton;
|
||||
JButton18: TJButton;
|
||||
JButton19: TJButton;
|
||||
JButton20: TJButton;
|
||||
JButton21: TJButton;
|
||||
JButton22: TJButton;
|
||||
JButton23: TJButton;
|
||||
JButton24: TJButton;
|
||||
JButton8: TJButton;
|
||||
JButton9: TJButton;
|
||||
JLabel1: TJLabel;
|
||||
JLabel10: TJLabel;
|
||||
JLabel11: TJLabel;
|
||||
JLabel12: TJLabel;
|
||||
JLabel13: TJLabel;
|
||||
JLabel14: TJLabel;
|
||||
JLabel15: TJLabel;
|
||||
JLabel16: TJLabel;
|
||||
JLabel17: TJLabel;
|
||||
JLabel18: TJLabel;
|
||||
JLabel19: TJLabel;
|
||||
JLabel2: TJLabel;
|
||||
JLabel3: TJLabel;
|
||||
JLabel4: TJLabel;
|
||||
JLabel5: TJLabel;
|
||||
JLabel6: TJLabel;
|
||||
JLabel7: TJLabel;
|
||||
JLabel8: TJLabel;
|
||||
JLabel9: TJLabel;
|
||||
PanelNumCentral: TPanel;
|
||||
PanelNumDerecho: TPanel;
|
||||
PanelNumInferior: TPanel;
|
||||
procedure JButton1Click(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.JButton1Click(Sender: TObject);
|
||||
begin
|
||||
ShowMessage('Hello World!');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -7,7 +7,7 @@ object Form1: TForm1
|
||||
ClientHeight = 347
|
||||
ClientWidth = 419
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.1'
|
||||
LCLVersion = '0.9.31'
|
||||
object DBNavigator1: TDBNavigator
|
||||
Left = 8
|
||||
Height = 25
|
||||
@ -29,54 +29,57 @@ object Form1: TForm1
|
||||
object JDBGridControl1: TJDBGridControl
|
||||
Left = 8
|
||||
Height = 192
|
||||
Top = 96
|
||||
Top = 112
|
||||
Width = 392
|
||||
AlternateColor = clMoneyGreen
|
||||
AutoFillColumns = True
|
||||
Color = clWindow
|
||||
Columns = <
|
||||
item
|
||||
Title.Caption = 'ID'
|
||||
Width = 121
|
||||
Title.PrefixOption = poNone
|
||||
FieldName = 'ID'
|
||||
Decimals = 0
|
||||
MaxLength = 0
|
||||
end
|
||||
item
|
||||
Title.Caption = 'DATE'
|
||||
Width = 121
|
||||
Title.PrefixOption = poNone
|
||||
FieldName = 'DATE'
|
||||
DisplayFormat = 'dd/mm/yyyy'
|
||||
Decimals = 0
|
||||
MaxLength = 0
|
||||
end
|
||||
item
|
||||
Title.Caption = 'QUANTITY'
|
||||
Width = 121
|
||||
Title.PrefixOption = poNone
|
||||
Width = 150
|
||||
FieldName = 'QUANTITY'
|
||||
DisplayFormat = '#,0.00000€'
|
||||
Decimals = 0
|
||||
MaxLength = 0
|
||||
end>
|
||||
DataSource = Datasource1
|
||||
TabOrder = 1
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 13
|
||||
Height = 17
|
||||
Top = 296
|
||||
Width = 391
|
||||
Caption = 'Press Alt+Down arrow key while editing date to show the calendar'
|
||||
ParentColor = False
|
||||
object MemDataset1: TMemDataset
|
||||
Active = True
|
||||
FieldDefs = <
|
||||
item
|
||||
Name = 'ID'
|
||||
DataType = ftInteger
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end
|
||||
item
|
||||
Name = 'DATE'
|
||||
DataType = ftDate
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end
|
||||
item
|
||||
Name = 'QUANTITY'
|
||||
DataType = ftFloat
|
||||
Precision = 0
|
||||
Size = 0
|
||||
end>
|
||||
left = 232
|
||||
top = 8
|
||||
end
|
||||
object Datasource1: TDatasource
|
||||
DataSet = BufDataset1
|
||||
DataSet = MemDataset1
|
||||
left = 324
|
||||
top = 7
|
||||
end
|
||||
object BufDataset1: TBufDataset
|
||||
FieldDefs = <>
|
||||
left = 232
|
||||
top = 7
|
||||
end
|
||||
end
|
||||
|
@ -5,19 +5,18 @@ unit main;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, db, BufDataset, FileUtil, Forms, Controls, Graphics,
|
||||
Dialogs, DbCtrls, DBGrids, StdCtrls, JDBGridControl;
|
||||
Classes, SysUtils, memds, db, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
DbCtrls, DBGrids, JDBGridControl;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BufDataset1: TBufDataset;
|
||||
Datasource1: TDatasource;
|
||||
DBNavigator1: TDBNavigator;
|
||||
JDBGridControl1: TJDBGridControl;
|
||||
Label1: TLabel;
|
||||
MemDataset1: TMemDataset;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
@ -38,24 +37,16 @@ procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
// Create BufDataset
|
||||
with BufDataset1.FieldDefs do
|
||||
begin
|
||||
Add('ID', ftInteger, 0, False);
|
||||
Add('DATE', ftDate, 0, False);
|
||||
Add('QUANTITY', ftCurrency, 0, False);
|
||||
end;
|
||||
BufDataset1.CreateDataset;
|
||||
// populate
|
||||
// populate the memDataset
|
||||
for i := 1 to 10 do
|
||||
begin
|
||||
BufDataset1.Append;
|
||||
BufDataset1.FieldByName('ID').AsInteger := i;
|
||||
BufDataset1.FieldByName('DATE').AsDateTime := Now;
|
||||
BufDataset1.FieldByName('QUANTITY').AsFloat := i * i * i;
|
||||
BufDataset1.Post;
|
||||
MemDataset1.Append;
|
||||
MemDataset1.FieldByName('ID').AsInteger := i;
|
||||
MemDataset1.FieldByName('DATE').AsDateTime := Now;
|
||||
MemDataset1.FieldByName('QUANTITY').AsFloat := i * i * i;
|
||||
MemDataset1.Post;
|
||||
end;
|
||||
BufDataset1.First;
|
||||
MemDataset1.First;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
@ -25,9 +25,10 @@
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<RequiredPackages Count="4">
|
||||
<Item1>
|
||||
<PackageName Value="jujiboutils"/>
|
||||
</Item1>
|
||||
@ -35,8 +36,11 @@
|
||||
<PackageName Value="FCL"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
<PackageName Value="MemDSLaz"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
@ -48,14 +52,13 @@
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="main"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Version Value="10"/>
|
||||
<Target>
|
||||
<Filename Value="testgridctr"/>
|
||||
</Target>
|
||||
@ -64,6 +67,10 @@
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="True"/>
|
||||
<DebugInfoType Value="dsAuto"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
|
@ -7,7 +7,7 @@ uses
|
||||
cthreads,
|
||||
{$ENDIF}clocale,{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, main
|
||||
Forms, memdslaz, main
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
@ -21,7 +21,7 @@ different kinds of data, floats, dates, etc. while working with
|
||||
db and non db controls."/>
|
||||
<License Value="LGPL with link exception. Read files license-jujiboutils and COPYING.LGPL"/>
|
||||
<Version Major="1"/>
|
||||
<Files Count="19">
|
||||
<Files Count="23">
|
||||
<Item1>
|
||||
<Filename Value="src/jcontrolutils.pas"/>
|
||||
<UnitName Value="jcontrolutils"/>
|
||||
@ -114,6 +114,25 @@ db and non db controls."/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="JDBImageBlob"/>
|
||||
</Item19>
|
||||
<Item20>
|
||||
<Filename Value="src/jlabel.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="JLabel"/>
|
||||
</Item20>
|
||||
<Item21>
|
||||
<Filename Value="src/jdblabel.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="JDbLabel"/>
|
||||
</Item21>
|
||||
<Item22>
|
||||
<Filename Value="src/jbutton.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="JButton"/>
|
||||
</Item22>
|
||||
<Item23>
|
||||
<Filename Value="src/jdbutils.pas"/>
|
||||
<UnitName Value="jdbutils"/>
|
||||
</Item23>
|
||||
</Files>
|
||||
<i18n>
|
||||
<EnableI18N Value="True"/>
|
||||
|
@ -12,7 +12,7 @@ uses
|
||||
JLabeledIntegerEdit, JLabeledFloatEdit, JLabeledCurrencyEdit,
|
||||
JLabeledDateEdit, jdbgridutils, JLabeledTimeEdit, JDBLabeledTimeEdit,
|
||||
JLabeledDateTimeEdit, JDBLabeledDateTimeEdit, jinputconsts, JDbEnumCombo,
|
||||
JDBImageBlob, LazarusPackageIntf;
|
||||
JDBImageBlob, JLabel, JDbLabel, JButton, jdbutils, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
@ -34,6 +34,9 @@ begin
|
||||
RegisterUnit('JDBLabeledDateTimeEdit', @JDBLabeledDateTimeEdit.Register);
|
||||
RegisterUnit('JDbEnumCombo', @JDbEnumCombo.Register);
|
||||
RegisterUnit('JDBImageBlob', @JDBImageBlob.Register);
|
||||
RegisterUnit('JLabel', @JLabel.Register);
|
||||
RegisterUnit('JDbLabel', @JDbLabel.Register);
|
||||
RegisterUnit('JButton', @JButton.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
181
components/jujiboutils/src/jbutton.pas
Normal file
181
components/jujiboutils/src/jbutton.pas
Normal file
@ -0,0 +1,181 @@
|
||||
{ TJButton
|
||||
|
||||
Copyright (C) 2012 Julio Jiménez Borreguero
|
||||
Contact: jujibo at gmail dot com
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the same terms as the Lazarus Component Library (LCL)
|
||||
|
||||
See the file license-jujiboutils.txt and COPYING.LGPL, included in this distribution,
|
||||
for details about the license.
|
||||
|
||||
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.
|
||||
|
||||
}
|
||||
|
||||
unit JButton;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
JLabel;
|
||||
|
||||
type
|
||||
|
||||
{ TJButton }
|
||||
|
||||
TJButton = class(TCustomPanel)
|
||||
private
|
||||
FImage: TImage;
|
||||
FJLabel: TJLabel;
|
||||
//OldBevel: TPanelBevel;
|
||||
{ Private declarations }
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure SetName(const Value: TComponentName); override;
|
||||
procedure JLabel1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: integer);
|
||||
procedure JLabel1MouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: integer);
|
||||
procedure JLabel1MouseClick(Sender: TObject);
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
published
|
||||
{ Published declarations }
|
||||
property LCaption: TJLabel read FJLabel;
|
||||
property Image: TImage read FImage;
|
||||
property Align;
|
||||
property Alignment;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BorderSpacing;
|
||||
property BevelInner;
|
||||
property BevelOuter;
|
||||
property BevelWidth;
|
||||
property BidiMode;
|
||||
property BorderWidth;
|
||||
property BorderStyle;
|
||||
property ChildSizing;
|
||||
property ClientHeight;
|
||||
property ClientWidth;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property DockSite;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
//property Font;
|
||||
property FullRepaint;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
//property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property TabOrder;
|
||||
property TabStop;
|
||||
property UseDockManager default True;
|
||||
property Visible;
|
||||
property OnClick;
|
||||
property OnContextPopup;
|
||||
property OnDockDrop;
|
||||
property OnDockOver;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDock;
|
||||
property OnEndDrag;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnGetSiteInfo;
|
||||
property OnGetDockCaption;
|
||||
property OnMouseDown;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnResize;
|
||||
property OnStartDock;
|
||||
property OnStartDrag;
|
||||
property OnUnDock;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jbutton_icon.lrs}
|
||||
RegisterComponents('Jujibo', [TJButton]);
|
||||
end;
|
||||
|
||||
{ TJButton }
|
||||
|
||||
procedure TJButton.SetName(const Value: TComponentName);
|
||||
var
|
||||
ChangeText: boolean;
|
||||
begin
|
||||
inherited SetName(Value);
|
||||
if (csDesigning in ComponentState) and (FJLabel.Caption = FJLabel.Name) then
|
||||
FJLabel.Caption := Value;
|
||||
end;
|
||||
|
||||
procedure TJButton.JLabel1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: integer);
|
||||
begin
|
||||
//OldBevel:= BevelOuter;
|
||||
BevelOuter := bvLowered;
|
||||
end;
|
||||
|
||||
procedure TJButton.JLabel1MouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: integer);
|
||||
begin
|
||||
BevelOuter := bvRaised; //OldBevel;
|
||||
end;
|
||||
|
||||
procedure TJButton.JLabel1MouseClick(Sender: TObject);
|
||||
begin
|
||||
if Assigned(OnClick) then
|
||||
Click;
|
||||
end;
|
||||
|
||||
constructor TJButton.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
Width := 65;
|
||||
Height := 65;
|
||||
ControlStyle := ControlStyle - [csSetCaption]; // No caption
|
||||
// Image
|
||||
FImage := TImage.Create(Self);
|
||||
FImage.Name := 'Image';
|
||||
FImage.Parent := Self;
|
||||
FImage.SetSubComponent(True);
|
||||
FImage.Align := alClient;
|
||||
FImage.ControlStyle := FImage.ControlStyle + [csNoDesignSelectable] - [csSetCaption];
|
||||
// JLabel
|
||||
FJLabel := TJLabel.Create(Self);
|
||||
FJLabel.Name := 'JLabel';
|
||||
FJLabel.Parent := Self;
|
||||
FJLabel.ParentFont := False;
|
||||
FJLabel.SetSubComponent(True);
|
||||
FJLabel.ControlStyle := FJLabel.ControlStyle + [csNoDesignSelectable] -
|
||||
[csDoubleClicks];
|
||||
FJLabel.Alignment := taCenter;
|
||||
FJLabel.Layout := tlCenter;
|
||||
FJLabel.Align := alClient;
|
||||
FJLabel.OnMouseDown := @JLabel1MouseDown;
|
||||
FJLabel.OnMouseUp := @JLabel1MouseUp;
|
||||
FJLabel.OnClick := @JLabel1MouseClick;
|
||||
end;
|
||||
|
||||
end.
|
24
components/jujiboutils/src/jbutton_icon.lrs
Normal file
24
components/jujiboutils/src/jbutton_icon.lrs
Normal file
@ -0,0 +1,24 @@
|
||||
LazarusResources.Add('TJButton','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147
|
||||
+#0#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#7'tIME'#7#221#1#9#11
|
||||
+'%'#18'5'#3#141'%'#0#0#1#174'IDATH'#199#213#149'=L'#194'P'#20#133'O'#145#159
|
||||
+#7'F'#196#13'G'#18#23#226'`dR'#7'$,'#196'0'#0'N'#196#193#133#5#6'M'#156#202
|
||||
+#162'+'#16'L4'#152'0'#233#224#164#12#14','#174#150#154'4qdb1'#1'b"n'#148'8'
|
||||
+#128'qx'#14#181#133#210#2#138'u'#224'$MoO'#127#190's'#219#230'>`'#214#197#200
|
||||
+#5#203#22#168'Q'#15#205#229#14#25#141#201#178#5'j'#132'X'#182'@y'#174#162#132
|
||||
+'5'#15#131#26#141#231#169#147#191'4_5'#158#6#16'?'#231#167#6#228'c+'#147#1'f'
|
||||
+#226'0'#244'#'#235#0#156'J'#157#9'-'#129#16#130#163'r'#203'@'#192#130#212'A>'
|
||||
+#184#8#175#215#7'Ql!'#19#234#225'X'#248'0'#6'`'#155#183#1#0'z'#189#30'D'#177
|
||||
+#5#151'k'#25#128#160#248#227#245'9'#25'`'#177#18#233'_'#174#1','#234#0#4#228
|
||||
+'j'#4#22'+'#140#1#204'9\J}'#218#148#246#229#132#7#0#176'{S'#159#0'x'#255'A'#7
|
||||
+'N'#251#200#219#239#226#30#196#239#223'4~4'#200#161#141'6'#240#180':'#25'P'
|
||||
+#10#187#149'z'#255'AT'#207#21#6#0#220#138#31#219#224#16#179'GQB|`"T'#245#211
|
||||
+#201#163'"!t)'#165#148#2#210#150#16#186'J='#232#23#187'E'#149'/'#159#163#148
|
||||
+#170'F'#133'i'#24't'#181'E'#190#147'J'#186#220'$'#186#129'R$'#165':'#142#220
|
||||
+'F'#192's'#218')`'#210#190#2')'#215'o'#213'iu'#0#0#233#244#197'h'#192'_T'#185
|
||||
+'>'#129'?'#224#31#223#129#156#156'aF,'#30#3#29'2'#190'$'#176#158#236#251#213
|
||||
+' '#0' '#155'='#24#223#1#207#241#232#127'J}'#239#177#194#131'?'#219#147'6'
|
||||
+#157#235#255'}E'#11#239#172#193#31#216'fT'#0')i'#197'0'#136#12#152'}}'#1'{'
|
||||
+#10#254'd'#148#224'PU'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
@ -116,10 +116,13 @@ procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdbenumcombo_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDbEnumCombo]);
|
||||
RegisterComponents('JujiboDB', [TJDbEnumCombo]);
|
||||
end;
|
||||
|
||||
{ TJDbEnumCombo }
|
||||
@ -173,7 +176,7 @@ begin
|
||||
if Assigned(DataLinkField) then
|
||||
ItemIndex := DataLinkField.AsInteger
|
||||
else
|
||||
ItemIndex:= -1;
|
||||
ItemIndex := -1;
|
||||
end;
|
||||
|
||||
procedure TJDbEnumCombo.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
@ -188,6 +191,8 @@ end;
|
||||
|
||||
procedure TJDbEnumCombo.Change;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or ReadOnly then
|
||||
exit;
|
||||
FDataLink.Edit;
|
||||
FDataLink.Modified;
|
||||
FDataLink.UpdateRecord;
|
||||
@ -196,12 +201,15 @@ end;
|
||||
|
||||
procedure TJDbEnumCombo.DropDown;
|
||||
begin
|
||||
FDataLink.Edit;
|
||||
if not FieldIsEditable(Field) or ReadOnly then
|
||||
abort;
|
||||
inherited DropDown;
|
||||
end;
|
||||
|
||||
procedure TJDbEnumCombo.UpdateData(Sender: TObject);
|
||||
begin
|
||||
if not FieldIsEditable(Field) or ReadOnly then
|
||||
exit;
|
||||
FDataLink.Field.AsInteger := ItemIndex;
|
||||
end;
|
||||
|
||||
@ -213,7 +221,7 @@ begin
|
||||
FDataLink.Control := Self;
|
||||
FDataLink.OnDataChange := @DataChange;
|
||||
FDataLink.OnUpdateData := @UpdateData;
|
||||
Style:= csDropDownList;
|
||||
Style := csDropDownList;
|
||||
end;
|
||||
|
||||
destructor TJDbEnumCombo.Destroy;
|
||||
|
@ -93,7 +93,7 @@ implementation
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdbgridcontrol_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBGridControl]);
|
||||
RegisterComponents('JujiboDB', [TJDBGridControl]);
|
||||
end;
|
||||
|
||||
function TJDBColumn.getDecimals: integer;
|
||||
|
@ -93,7 +93,7 @@ implementation
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdbimageblob_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBImageBlob]);
|
||||
RegisterComponents('JujiboDB', [TJDBImageBlob]);
|
||||
end;
|
||||
|
||||
{ TJDBImageBlob }
|
||||
|
187
components/jujiboutils/src/jdblabel.pas
Normal file
187
components/jujiboutils/src/jdblabel.pas
Normal file
@ -0,0 +1,187 @@
|
||||
{ TJDbLabel
|
||||
|
||||
Copyright (C) 2013 Julio Jiménez Borreguero
|
||||
Contact: jujibo at gmail dot com
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the same terms as the Lazarus Component Library (LCL)
|
||||
|
||||
See the file license-jujiboutils.txt and COPYING.LGPL, included in this distribution,
|
||||
for details about the license.
|
||||
|
||||
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.
|
||||
|
||||
}
|
||||
|
||||
unit JDbLabel;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
JLabel, DB, DBCtrls, LMessages;
|
||||
|
||||
type
|
||||
|
||||
{ TJDbLabel }
|
||||
|
||||
TJDbLabel = class(TJCustomLabel)
|
||||
private
|
||||
{ Private declarations }
|
||||
FDataLink: TFieldDataLink;
|
||||
|
||||
procedure DataChange(Sender: TObject);
|
||||
function GetDataField: string;
|
||||
function GetDataSource: TDataSource;
|
||||
function GetField: TField;
|
||||
|
||||
procedure SetDataField(const Value: string);
|
||||
procedure SetDataSource(Value: TDataSource);
|
||||
procedure CMGetDataLink(var Message: TLMessage); message CM_GETDATALINK;
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure Loaded; override;
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property Field: TField read GetField;
|
||||
published
|
||||
{ Published declarations }
|
||||
property DataField: string read GetDataField write SetDataField;
|
||||
property DataSource: TDataSource read GetDataSource write SetDataSource;
|
||||
|
||||
property ShadowColor;
|
||||
property ShadowColor2;
|
||||
property LabelStyle;
|
||||
property Align;
|
||||
property Alignment;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
property FocusControl;
|
||||
property Font;
|
||||
property Layout;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowAccelChar;
|
||||
property ShowHint;
|
||||
property Transparent;
|
||||
property Visible;
|
||||
property WordWrap;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnChangeBounds;
|
||||
property OnContextPopup;
|
||||
property OnResize;
|
||||
property OnStartDrag;
|
||||
property OptimalFill;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdblabel_icon.lrs}
|
||||
RegisterComponents('JujiboDB', [TJDbLabel]);
|
||||
end;
|
||||
|
||||
{ TJDbLabel }
|
||||
|
||||
procedure TJDbLabel.DataChange(Sender: TObject);
|
||||
begin
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FDataLink.Field.DisplayText
|
||||
else if csDesigning in ComponentState then
|
||||
Caption := Name
|
||||
else
|
||||
Caption := '';
|
||||
end;
|
||||
|
||||
function TJDbLabel.GetDataField: string;
|
||||
begin
|
||||
Result := FDataLink.FieldName;
|
||||
end;
|
||||
|
||||
function TJDbLabel.GetDataSource: TDataSource;
|
||||
begin
|
||||
Result := FDataLink.DataSource;
|
||||
end;
|
||||
|
||||
function TJDbLabel.GetField: TField;
|
||||
begin
|
||||
Result := FDataLink.Field;
|
||||
end;
|
||||
|
||||
procedure TJDbLabel.SetDataField(const Value: string);
|
||||
begin
|
||||
FDataLink.FieldName := Value;
|
||||
end;
|
||||
|
||||
procedure TJDbLabel.SetDataSource(Value: TDataSource);
|
||||
begin
|
||||
ChangeDataSource(Self, FDataLink, Value);
|
||||
end;
|
||||
|
||||
procedure TJDbLabel.CMGetDataLink(var Message: TLMessage);
|
||||
begin
|
||||
Message.Result := PtrUInt(FDataLink);
|
||||
end;
|
||||
|
||||
procedure TJDbLabel.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 TJDbLabel.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
if csDesigning in ComponentState then
|
||||
Caption := Name;
|
||||
end;
|
||||
|
||||
constructor TJDbLabel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FDataLink := TFieldDataLink.Create;
|
||||
FDataLink.Control := Self;
|
||||
FDataLink.OnDataChange := @DataChange;
|
||||
end;
|
||||
|
||||
destructor TJDbLabel.Destroy;
|
||||
begin
|
||||
FDataLink.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
end.
|
23
components/jujiboutils/src/jdblabel_icon.lrs
Normal file
23
components/jujiboutils/src/jdblabel_icon.lrs
Normal file
@ -0,0 +1,23 @@
|
||||
LazarusResources.Add('tjdblabel','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147#0#0#0#9'pHYs'#0#0#11#19#0#0#11
|
||||
+#19#1#0#154#156#24#0#0#0#7'tIME'#7#221#8#24#10'+5'#234#253'-|'#0#0#1#150'IDA'
|
||||
+'TH'#199#237#148'?HBQ'#20#198#127'7"'#8#162'$S'#161#232#159' '#24#153'nA'#24
|
||||
+#13'E['#212#28#173'55'#212'TA'#179'C.'#209#236#28#205#129#171#14#145#4'mYQ '
|
||||
+#8#21'6'#188'"'#180#12#158#162#189#6'{'#245#174'>C'#13#135#192#179#188#251
|
||||
+#206#251#206#247#157#239#220'w/49'#132#241#229#232#228'Q'#11#133#147#166#192
|
||||
+#181#5''''#203'3'#253#162'!'#1'#'#241#193#186#15#207'P'#23'W'#247'Y'#148't'
|
||||
+#14'%'#147'GI'#231'8>M5$'#212#14#16#10''''#241#186'z'#25'ut'#162#164's\'#129
|
||||
+'D'#174'd'#242'x]'#189'd'#213#2#213#28#254'*'#224#28#236'&'#158'x!'#158#0#187
|
||||
+#197#9' '#145#191#171'E'#226#137#23'tl'#180'^'#1#128#169#9#27#246#158#142#170
|
||||
+#29'NM'#216'xW'#139'd'#213'B'#253#14#146#15#175'8,6'#0'vW'#220#204'z'#173#21
|
||||
+'{'#160'd'#242#232#216#134'Ft~'#253'L'#241'C'#195'3'#236'6'#5#158']>'#253'mD'
|
||||
+#147#227'}'#216'{:'#8#28#222#18'8'#148'A'#209#160#31#24'a3t'#211#156#17'E'
|
||||
+#131'%'#240#254#234#24's'#219#177#191#141'hc'#209#255#245#169#139#200'EN>4'#2
|
||||
+#192'_F'#161'i'#152#160#244'h3'#142'hiz'#128#217#173#216'w'#201#156#207'*'
|
||||
+#253'U?T'#250#170#244#212'4cF'#22'l'#3#184'K'#189'I'#243'6'#246#16#217#243
|
||||
+#155'Z/'''#18'B'#136#242#238#165';h~'''#166#233#189#148#138#235']'#215'p'#217
|
||||
+#25'-'#235#189#212#190#22'B'#206#154#10'TnZe'#137#145#176#26#254#167#162#221
|
||||
+#196#148#168#180','#231#140#4#230#248'V'#180#226'_'#197''''#1'a'#7#148#142
|
||||
+#187'@8'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
@ -134,12 +134,12 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
Math, jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I lcurrencydbicon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledCurrencyEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledCurrencyEdit]);
|
||||
end;
|
||||
|
||||
{ TJDBLabeledCurrencyEdit }
|
||||
@ -339,6 +339,8 @@ end;
|
||||
|
||||
procedure TJDBLabeledCurrencyEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
if (Key in ['.', ',']) then
|
||||
Key := Decimalseparator;
|
||||
if (key = DecimalSeparator) and (Pos(key, Text) > 0) then
|
||||
@ -353,6 +355,8 @@ end;
|
||||
|
||||
procedure TJDBLabeledCurrencyEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FDataLink.Field.AsString;
|
||||
inherited DoEnter;
|
||||
@ -382,6 +386,8 @@ end;
|
||||
procedure TJDBLabeledCurrencyEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
UpdateData(self)
|
||||
else
|
||||
|
@ -147,12 +147,12 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
jcontrolutils, dateutils;
|
||||
jcontrolutils, dateutils, jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I ldatedbicon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledDateEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledDateEdit]);
|
||||
end;
|
||||
|
||||
{ TJDBLabeledDateEdit }
|
||||
@ -438,18 +438,17 @@ end;
|
||||
|
||||
procedure TJDBLabeledDateEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
if (not Assigned(FDataLink.Field)) or IsReadOnly then
|
||||
key := #0;
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
if not (Key in ['0'..'9', #8, #9, '.', '-', '/']) then
|
||||
Key := #0
|
||||
else
|
||||
if not IsReadOnly then
|
||||
FDatalink.Edit;
|
||||
Key := #0;
|
||||
inherited KeyPress(Key);
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledDateEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FDataLink.Field.AsString;
|
||||
inherited DoEnter;
|
||||
@ -488,7 +487,7 @@ end;
|
||||
procedure TJDBLabeledDateEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if (not Assigned(FDataLink.Field)) or IsReadOnly then
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
UpdateData(self)
|
||||
|
@ -154,12 +154,12 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
jcontrolutils, dateutils;
|
||||
jcontrolutils, dateutils, jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdblabeleddatetimeedit_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledDateTimeEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledDateTimeEdit]);
|
||||
end;
|
||||
|
||||
function TJDBLabeledDateTimeEdit.GetButtonWidth: integer;
|
||||
@ -443,18 +443,19 @@ end;
|
||||
|
||||
procedure TJDBLabeledDateTimeEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
if (not Assigned(FDataLink.Field)) or IsReadOnly then
|
||||
key := #0;
|
||||
if not (Key in ['0'..'9', #8, #9, '.', '-', '/', ',', ':', ' ']) then
|
||||
Key := #0
|
||||
else
|
||||
if not IsReadOnly then
|
||||
FDatalink.Edit;
|
||||
Key := #0;
|
||||
inherited KeyPress(Key);
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledDateTimeEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := EditText;
|
||||
inherited DoEnter;
|
||||
@ -493,6 +494,8 @@ end;
|
||||
procedure TJDBLabeledDateTimeEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if (not Assigned(FDataLink.Field)) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
|
@ -121,10 +121,13 @@ procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdblabelededit_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledEdit]);
|
||||
end;
|
||||
|
||||
{ TJDBLabeledEdit }
|
||||
@ -240,14 +243,15 @@ end;
|
||||
|
||||
procedure TJDBLabeledEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
inherited KeyPress(Key);
|
||||
if not IsReadOnly then
|
||||
FDatalink.Edit;
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
inherited KeyPress(Key);
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FDataLink.Field.AsString;
|
||||
inherited DoEnter;
|
||||
@ -285,6 +289,8 @@ end;
|
||||
procedure TJDBLabeledEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
UpdateData(self);
|
||||
end;
|
||||
|
@ -134,12 +134,12 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
Math, jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdblabeledfloatedit_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledFloatEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledFloatEdit]);
|
||||
end;
|
||||
|
||||
|
||||
@ -172,29 +172,29 @@ procedure TJDBLabeledFloatEdit.UpdateData(Sender: TObject);
|
||||
var
|
||||
theValue: double;
|
||||
begin
|
||||
if FDataLink.Field <> nil then
|
||||
if FDataLink.Field <> nil then
|
||||
begin
|
||||
if IsValidFloat(Text) then
|
||||
begin
|
||||
if IsValidFloat(Text) then
|
||||
begin
|
||||
theValue := StrToFloat(Text);
|
||||
if fDecimales > 0 then
|
||||
theValue := ScaleTo(theValue, fDecimales);
|
||||
Text := FloatToStr(theValue);
|
||||
FDataLink.Field.Value := theValue;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if FDataLink.Field <> nil then
|
||||
begin
|
||||
ShowMessage(Format(SInvalidNumber, [Caption]));
|
||||
Caption := FloatToStr(FDataLink.Field.AsFloat);
|
||||
SelectAll;
|
||||
SetFocus;
|
||||
end;
|
||||
end;
|
||||
theValue := StrToFloat(Text);
|
||||
if fDecimales > 0 then
|
||||
theValue := ScaleTo(theValue, fDecimales);
|
||||
Text := FloatToStr(theValue);
|
||||
FDataLink.Field.Value := theValue;
|
||||
end
|
||||
else
|
||||
Text := '';
|
||||
begin
|
||||
if FDataLink.Field <> nil then
|
||||
begin
|
||||
ShowMessage(Format(SInvalidNumber, [Caption]));
|
||||
Caption := FloatToStr(FDataLink.Field.AsFloat);
|
||||
SelectAll;
|
||||
SetFocus;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Text := '';
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledFloatEdit.FocusRequest(Sender: TObject);
|
||||
@ -338,6 +338,8 @@ end;
|
||||
|
||||
procedure TJDBLabeledFloatEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
if (Key in ['.', ',']) then
|
||||
Key := Decimalseparator;
|
||||
if (key = DecimalSeparator) and (Pos(key, Text) > 0) then
|
||||
@ -351,8 +353,10 @@ end;
|
||||
|
||||
procedure TJDBLabeledFloatEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FloatToStr(FDataLink.Field.AsFloat); //FDataLink.Field.AsString;
|
||||
Caption := FloatToStr(FDataLink.Field.AsFloat); //FDataLink.Field.AsString;
|
||||
inherited DoEnter;
|
||||
end;
|
||||
|
||||
@ -380,6 +384,8 @@ end;
|
||||
procedure TJDBLabeledFloatEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
UpdateData(self)
|
||||
else
|
||||
|
@ -129,10 +129,13 @@ procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
jdbutils;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I lintegerdbicon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledIntegerEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledIntegerEdit]);
|
||||
end;
|
||||
|
||||
{ TJDBLabeledIntegerEdit }
|
||||
@ -153,22 +156,22 @@ end;
|
||||
|
||||
procedure TJDBLabeledIntegerEdit.UpdateData(Sender: TObject);
|
||||
begin
|
||||
if FDataLink.Field <> nil then
|
||||
if FDataLink.Field <> nil then
|
||||
begin
|
||||
if IsValidInteger(Caption) then
|
||||
begin
|
||||
if IsValidInteger(Caption) then
|
||||
begin
|
||||
FDataLink.Field.Text := Text;
|
||||
end
|
||||
else
|
||||
begin
|
||||
ShowMessage(Format(SInvalidNumber, [Caption]));
|
||||
Caption := FDataLink.Field.AsString;
|
||||
SelectAll;
|
||||
SetFocus;
|
||||
end;
|
||||
FDataLink.Field.Text := Text;
|
||||
end
|
||||
else
|
||||
Text := '';
|
||||
begin
|
||||
ShowMessage(Format(SInvalidNumber, [Caption]));
|
||||
Caption := FDataLink.Field.AsString;
|
||||
SelectAll;
|
||||
SetFocus;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Text := '';
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledIntegerEdit.FocusRequest(Sender: TObject);
|
||||
@ -306,16 +309,17 @@ end;
|
||||
|
||||
procedure TJDBLabeledIntegerEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
if not (Key in ['0'..'9', #8, #9, '-']) then
|
||||
Key := #0
|
||||
else
|
||||
if not IsReadOnly then
|
||||
FDatalink.Edit;
|
||||
Key := #0;
|
||||
inherited KeyPress(Key);
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledIntegerEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FDataLink.Field.AsString;
|
||||
inherited DoEnter;
|
||||
@ -342,6 +346,8 @@ end;
|
||||
procedure TJDBLabeledIntegerEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
UpdateData(self)
|
||||
else
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
|
||||
SysUtils, jcontrolutils, jinputconsts;
|
||||
SysUtils, jcontrolutils, jinputconsts, jdbutils;
|
||||
|
||||
type
|
||||
TJDBLabeledTimeEdit = class(TCustomLabeledEdit)
|
||||
@ -109,7 +109,7 @@ implementation
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jdblabeledtimeedit_icon.lrs}
|
||||
RegisterComponents('Data Controls', [TJDBLabeledTimeEdit]);
|
||||
RegisterComponents('JujiboDB', [TJDBLabeledTimeEdit]);
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledTimeEdit.DataChange(Sender: TObject);
|
||||
@ -279,16 +279,17 @@ end;
|
||||
|
||||
procedure TJDBLabeledTimeEdit.KeyPress(var Key: char);
|
||||
begin
|
||||
if not FieldIsEditable(Field) or not FDatalink.Edit then
|
||||
Key := #0;
|
||||
if not (Key in ['0'..'9', #8, #9, ':']) then
|
||||
Key := #0
|
||||
else
|
||||
if not IsReadOnly then
|
||||
FDatalink.Edit;
|
||||
Key := #0;
|
||||
inherited KeyPress(Key);
|
||||
end;
|
||||
|
||||
procedure TJDBLabeledTimeEdit.DoEnter;
|
||||
begin
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if FDataLink.Field <> nil then
|
||||
Caption := FDataLink.Field.AsString;
|
||||
inherited DoEnter;
|
||||
@ -317,6 +318,8 @@ end;
|
||||
procedure TJDBLabeledTimeEdit.EditingDone;
|
||||
begin
|
||||
inherited EditingDone;
|
||||
if not FieldIsEditable(Field) or IsReadOnly then
|
||||
exit;
|
||||
if DataSource.State in [dsEdit, dsInsert] then
|
||||
UpdateData(self)
|
||||
else
|
||||
|
21
components/jujiboutils/src/jdbutils.pas
Normal file
21
components/jujiboutils/src/jdbutils.pas
Normal file
@ -0,0 +1,21 @@
|
||||
unit jdbutils;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, DB;
|
||||
|
||||
function FieldIsEditable(Field: TField): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
function FieldIsEditable(Field: TField): boolean;
|
||||
begin
|
||||
Result := (Field <> nil) and (not Field.Calculated) and
|
||||
(Field.DataType <> ftAutoInc) and (not Field.Lookup);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
292
components/jujiboutils/src/jlabel.pas
Normal file
292
components/jujiboutils/src/jlabel.pas
Normal file
@ -0,0 +1,292 @@
|
||||
{ TJLabel
|
||||
|
||||
Copyright (C) 2012 Julio Jiménez Borreguero
|
||||
Contact: jujibo at gmail dot com
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the same terms as the Lazarus Component Library (LCL)
|
||||
|
||||
See the file license-jujiboutils.txt and COPYING.LGPL, included in this distribution,
|
||||
for details about the license.
|
||||
|
||||
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.
|
||||
|
||||
}
|
||||
|
||||
unit JLabel;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
LMessages;
|
||||
|
||||
type
|
||||
|
||||
TLabelStyle = (lsNone, lsRaised, lsRecessed, lsShadow, lsShadow2, lsCustom);
|
||||
|
||||
{ TJCustomLabel }
|
||||
|
||||
TJCustomLabel = class(TCustomLabel)
|
||||
private
|
||||
{ Private declarations }
|
||||
FLabelStyle: TLabelStyle;
|
||||
FShadowColor: TColor;
|
||||
FShadowColor2: TColor;
|
||||
procedure SetLabelStyle(AValue: TLabelStyle);
|
||||
procedure SetShadowColor2(AValue: TColor);
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure SetShadowColor(Value: TColor);
|
||||
procedure Paint; override;
|
||||
|
||||
property ShadowColor: TColor read FShadowColor write SetShadowColor;
|
||||
property ShadowColor2: TColor read FShadowColor2 write SetShadowColor2;
|
||||
property LabelStyle: TLabelStyle read FLabelStyle write SetLabelStyle;
|
||||
property Align;
|
||||
property Alignment;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
property FocusControl;
|
||||
property Font;
|
||||
property Layout;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowAccelChar;
|
||||
property ShowHint;
|
||||
property Transparent;
|
||||
property Visible;
|
||||
property WordWrap;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnChangeBounds;
|
||||
property OnContextPopup;
|
||||
property OnResize;
|
||||
property OnStartDrag;
|
||||
property OptimalFill;
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
TJLabel = class(TJCustomLabel)
|
||||
published
|
||||
property ShadowColor;
|
||||
property ShadowColor2;
|
||||
property LabelStyle;
|
||||
property Align;
|
||||
property Alignment;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
property FocusControl;
|
||||
property Font;
|
||||
property Layout;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowAccelChar;
|
||||
property ShowHint;
|
||||
property Transparent;
|
||||
property Visible;
|
||||
property WordWrap;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnChangeBounds;
|
||||
property OnContextPopup;
|
||||
property OnResize;
|
||||
property OnStartDrag;
|
||||
property OptimalFill;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabel_icon.lrs}
|
||||
RegisterComponents('Jujibo', [TJLabel]);
|
||||
end;
|
||||
|
||||
{ TJCustomLabel }
|
||||
|
||||
procedure TJCustomLabel.SetShadowColor2(AValue: TColor);
|
||||
begin
|
||||
if FShadowColor2 <> AValue then
|
||||
begin
|
||||
FLabelStyle := lsCustom;
|
||||
FShadowColor2 := AValue;
|
||||
Perform(CM_COLORCHANGED, 0, 0);
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJCustomLabel.SetLabelStyle(AValue: TLabelStyle);
|
||||
begin
|
||||
if FLabelStyle = AValue then
|
||||
Exit;
|
||||
FLabelStyle := AValue;
|
||||
case FLabelStyle of
|
||||
lsNone:
|
||||
begin
|
||||
FShadowColor := clNone;
|
||||
FShadowColor2 := clNone;
|
||||
end;
|
||||
lsRaised:
|
||||
begin
|
||||
FShadowColor := clBtnHighlight;
|
||||
FShadowColor2 := clBtnShadow;
|
||||
end;
|
||||
lsRecessed:
|
||||
begin
|
||||
FShadowColor := clBtnShadow;
|
||||
FShadowColor2 := clBtnHighlight;
|
||||
end;
|
||||
lsShadow:
|
||||
begin
|
||||
FShadowColor := clBtnHighlight;
|
||||
FShadowColor2 := clNone;
|
||||
end;
|
||||
lsShadow2:
|
||||
begin
|
||||
FShadowColor := clNone;
|
||||
FShadowColor2 := clBtnHighlight;
|
||||
end;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TJCustomLabel.SetShadowColor(Value: TColor);
|
||||
begin
|
||||
if FShadowColor <> Value then
|
||||
begin
|
||||
FLabelStyle := lsCustom;
|
||||
FShadowColor := Value;
|
||||
Perform(CM_COLORCHANGED, 0, 0);
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJCustomLabel.Paint;
|
||||
var
|
||||
TR: TTextStyle;
|
||||
R, R1, R2: TRect;
|
||||
TextLeft, TextTop: integer;
|
||||
LabelText: string;
|
||||
OldFontColor: TColor;
|
||||
Color1, Color2: TColor;
|
||||
begin
|
||||
R := Rect(0, 0, Width, Height);
|
||||
R1 := Rect(1, 1, Width + 1, Height + 1); // Shadow
|
||||
R2 := Rect(-1, -1, Width - 1, Height - 1); // Shadow2
|
||||
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Color := Self.Color;
|
||||
if (Color <> clNone) and not Transparent then
|
||||
begin
|
||||
Brush.Style := bsSolid;
|
||||
FillRect(R);
|
||||
end;
|
||||
Brush.Style := bsClear;
|
||||
Font := Self.Font;
|
||||
|
||||
FillChar(TR, SizeOf(TR), 0);
|
||||
with TR do
|
||||
begin
|
||||
Alignment := BidiFlipAlignment(Self.Alignment, UseRightToLeftAlignment);
|
||||
Layout := Self.Layout;
|
||||
Opaque := (Color <> clNone) and not Transparent;
|
||||
WordBreak := wordWrap;
|
||||
SingleLine := not WordWrap and not HasMultiLine;
|
||||
Clipping := True;
|
||||
ShowPrefix := ShowAccelChar;
|
||||
SystemFont := False;
|
||||
RightToLeft := UseRightToLeftReading;
|
||||
ExpandTabs := True;
|
||||
end;
|
||||
DoMeasureTextPosition(TextTop, TextLeft);
|
||||
//debugln('TCustomLabel.Paint ',dbgs(Alignment=tacenter),' ',dbgs(Layout=tlCenter),' ',dbgs(TextLeft),' TextTop=',dbgs(TextTop),' ',dbgs(R));
|
||||
LabelText := GetLabelText;
|
||||
OldFontColor := Font.Color;
|
||||
if not IsEnabled then
|
||||
begin
|
||||
Font.Color := clBtnHighlight;
|
||||
if (Layout <> tlTop) then
|
||||
TextRect(R1, TextLeft, TextTop, LabelText, TR)
|
||||
else
|
||||
TextRect(R, TextLeft + 1, TextTop + 1, LabelText, TR);
|
||||
Font.Color := clBtnShadow;
|
||||
end;
|
||||
if ShadowColor2 <> clNone then
|
||||
begin
|
||||
Font.Color := ShadowColor2;
|
||||
if (Layout <> tlTop) then
|
||||
TextRect(R2, TextLeft, TextTop, LabelText, TR)
|
||||
else
|
||||
TextRect(R, TextLeft - 1, TextTop - 1, LabelText, TR);
|
||||
Font.Color := OldFontColor;
|
||||
end;
|
||||
if ShadowColor <> clNone then
|
||||
begin
|
||||
Font.Color := ShadowColor;
|
||||
if (Layout <> tlTop) then
|
||||
TextRect(R1, TextLeft, TextTop, LabelText, TR)
|
||||
else
|
||||
TextRect(R, TextLeft + 1, TextTop + 1, LabelText, TR);
|
||||
Font.Color := OldFontColor;
|
||||
end;
|
||||
TextRect(R, TextLeft, TextTop, LabelText, TR);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TJCustomLabel.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
LabelStyle := lsRaised;
|
||||
end;
|
||||
|
||||
end.
|
14
components/jujiboutils/src/jlabel_icon.lrs
Normal file
14
components/jujiboutils/src/jlabel_icon.lrs
Normal file
@ -0,0 +1,14 @@
|
||||
LazarusResources.Add('tjlabel','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147#0#0#0#9'pHYs'#0#0#11#19#0#0#11
|
||||
+#19#1#0#154#156#24#0#0#0#7'tIME'#7#221#3#24#9#30'&'#185#228'!\'#0#0#0#180'ID'
|
||||
+'ATH'#199#237#149#203#17#131'0'#12'D'#181'Lj'#163#144'TB%)$'#205'='#14#177'A'
|
||||
+'('#198'0'#1#135#11#186'xF'#150'V+'#173'?'#2#172#165'u'#214#216#238#2#215#23
|
||||
+'x'#152#153#13#175#247#233#192#195#179#159#11'x'#199')'#224#142#240#174#17'I'
|
||||
+#134'd'#252'C'#3'~'#210' '#178#157#208'0'#133#189#143#219#249'cg1'#231#171#3
|
||||
+'0'#229#215#163#144#188#240#231#21#230#189#216'e'#181#131#141#177'D'#127'&'
|
||||
+#198'j'#7#158#209#1'S'#179#139'V:i]I i'#21'`'#210'B'#146'|'#188#3#175'k'#144
|
||||
+#146#136#208',?'#14#213#227'+'#5'Js'#4#18'cv'#205#253#176#6'J'#179#146#180#29
|
||||
+#11'4}'#236't'#255#201#151#23#24#1#157#205'N05'#9'4R'#0#0#0#0'IEND'#174'B`'
|
||||
+#130
|
||||
]);
|
@ -117,7 +117,7 @@ uses
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabeledcurrencyedit_icon.lrs}
|
||||
RegisterComponents('Additional', [TJLabeledCurrencyEdit]);
|
||||
RegisterComponents('Jujibo', [TJLabeledCurrencyEdit]);
|
||||
end;
|
||||
|
||||
{ TJLabeledCurrencyEdit }
|
||||
@ -180,6 +180,8 @@ end;
|
||||
procedure TJLabeledCurrencyEdit.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
Text := FloatToStr(theValue);
|
||||
SelectAll;
|
||||
end;
|
||||
@ -187,6 +189,8 @@ end;
|
||||
procedure TJLabeledCurrencyEdit.DoExit;
|
||||
begin
|
||||
inherited DoExit;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
if IsValidFloat(Text) then
|
||||
theValue := StrToCurr(Text)
|
||||
else
|
||||
@ -227,4 +231,3 @@ begin
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -127,7 +127,7 @@ implementation
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabeleddateedit_icon.lrs}
|
||||
RegisterComponents('Additional', [TJLabeledDateEdit]);
|
||||
RegisterComponents('Jujibo', [TJLabeledDateEdit]);
|
||||
end;
|
||||
|
||||
{ TJLabeledDateEdit }
|
||||
@ -185,6 +185,8 @@ end;
|
||||
procedure TJLabeledDateEdit.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
if theValue <> 0 then
|
||||
Text := FormatDateTime(DisplayFormat, theValue)
|
||||
else
|
||||
@ -195,6 +197,8 @@ end;
|
||||
procedure TJLabeledDateEdit.DoExit;
|
||||
begin
|
||||
inherited DoExit;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
Text := NormalizeDate(Text, theValue);
|
||||
if Length(Text) = 0 then
|
||||
theValue := 0
|
||||
|
@ -134,7 +134,7 @@ uses
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabeleddatetimeedit_icon.lrs}
|
||||
RegisterComponents('Additional', [TJLabeledDateTimeEdit]);
|
||||
RegisterComponents('Jujibo', [TJLabeledDateTimeEdit]);
|
||||
end;
|
||||
|
||||
function TJLabeledDateTimeEdit.GetButtonWidth: integer;
|
||||
@ -190,6 +190,8 @@ end;
|
||||
procedure TJLabeledDateTimeEdit.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
if theValue <> 0 then
|
||||
Text := FormatDateTime(DisplayFormat, theValue)
|
||||
else
|
||||
@ -202,6 +204,8 @@ var
|
||||
bufText: string;
|
||||
begin
|
||||
inherited DoExit;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
bufText := Text;
|
||||
Text := NormalizeDateTime(Text, theValue);
|
||||
if (Length(bufText) > 0) and (Length(Text) = 0) then
|
||||
|
@ -119,7 +119,7 @@ uses
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabeledfloatedit_icon.lrs}
|
||||
RegisterComponents('Additional', [TJLabeledFloatEdit]);
|
||||
RegisterComponents('Jujibo', [TJLabeledFloatEdit]);
|
||||
end;
|
||||
|
||||
function TJLabeledFloatEdit.getDecimals: integer;
|
||||
@ -139,7 +139,7 @@ end;
|
||||
|
||||
function TJLabeledFloatEdit.getCurrentValue: double;
|
||||
begin
|
||||
Result:= StrToFloatDef(Text, Value);
|
||||
Result := StrToFloatDef(Text, Value);
|
||||
end;
|
||||
|
||||
procedure TJLabeledFloatEdit.formatInput;
|
||||
@ -185,6 +185,8 @@ end;
|
||||
procedure TJLabeledFloatEdit.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
Text := FloatToStr(theValue);
|
||||
SelectAll;
|
||||
end;
|
||||
@ -192,6 +194,8 @@ end;
|
||||
procedure TJLabeledFloatEdit.DoExit;
|
||||
begin
|
||||
inherited DoExit;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
if IsValidFloat(Text) then
|
||||
theValue := StrToCurr(Text)
|
||||
else
|
||||
@ -230,4 +234,3 @@ begin
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -112,7 +112,7 @@ implementation
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabeledintegeredit_icon.lrs}
|
||||
RegisterComponents('Additional', [TJLabeledIntegerEdit]);
|
||||
RegisterComponents('Jujibo', [TJLabeledIntegerEdit]);
|
||||
end;
|
||||
|
||||
{ TJLabeledIntegerEdit }
|
||||
@ -160,6 +160,8 @@ end;
|
||||
procedure TJLabeledIntegerEdit.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
Text := IntToStr(theValue);
|
||||
SelectAll;
|
||||
end;
|
||||
@ -167,6 +169,8 @@ end;
|
||||
procedure TJLabeledIntegerEdit.DoExit;
|
||||
begin
|
||||
inherited DoExit;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
if IsValidInteger(Text) then
|
||||
theValue := StrToInt(Text)
|
||||
else
|
||||
|
@ -108,7 +108,7 @@ implementation
|
||||
procedure Register;
|
||||
begin
|
||||
{$I jlabeledtimeedit_icon.lrs}
|
||||
RegisterComponents('Additional', [TJLabeledTimeEdit]);
|
||||
RegisterComponents('Jujibo', [TJLabeledTimeEdit]);
|
||||
end;
|
||||
|
||||
|
||||
@ -146,6 +146,8 @@ end;
|
||||
procedure TJLabeledTimeEdit.DoEnter;
|
||||
begin
|
||||
inherited DoEnter;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
if not hasValue then
|
||||
Text := ''
|
||||
else
|
||||
@ -156,6 +158,8 @@ end;
|
||||
procedure TJLabeledTimeEdit.DoExit;
|
||||
begin
|
||||
inherited DoExit;
|
||||
if ReadOnly then
|
||||
exit;
|
||||
Text := NormalizeTime(Text, theValue);
|
||||
if Length(Text) = 0 then
|
||||
begin
|
||||
|
Reference in New Issue
Block a user