You've already forked lazarus-ccr
Jujiboutils 2.5
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8300 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<Package Version="4">
|
<Package Version="5">
|
||||||
<Name Value="jujiboutils"/>
|
<Name Value="jujiboutils"/>
|
||||||
<Type Value="RunAndDesignTime"/>
|
<Type Value="RunAndDesignTime"/>
|
||||||
<Author Value="Julio Jiménez Borreguero"/>
|
<Author Value="Julio Jiménez Borreguero"/>
|
||||||
@ -15,8 +15,8 @@
|
|||||||
different kinds of data, floats, dates, etc. while working with
|
different kinds of data, floats, dates, etc. while working with
|
||||||
db and non db controls."/>
|
db and non db controls."/>
|
||||||
<License Value="LGPL with link exception. Read files license-jujiboutils and COPYING.LGPL"/>
|
<License Value="LGPL with link exception. Read files license-jujiboutils and COPYING.LGPL"/>
|
||||||
<Version Major="2" Minor="4"/>
|
<Version Major="2" Minor="5"/>
|
||||||
<Files Count="23">
|
<Files Count="36">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="src/jcontrolutils.pas"/>
|
<Filename Value="src/jcontrolutils.pas"/>
|
||||||
<UnitName Value="jcontrolutils"/>
|
<UnitName Value="jcontrolutils"/>
|
||||||
@ -128,7 +128,74 @@ db and non db controls."/>
|
|||||||
<Filename Value="src/jdbutils.pas"/>
|
<Filename Value="src/jdbutils.pas"/>
|
||||||
<UnitName Value="jdbutils"/>
|
<UnitName Value="jdbutils"/>
|
||||||
</Item23>
|
</Item23>
|
||||||
|
<Item24>
|
||||||
|
<Filename Value="src/jintegeredit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JIntegerEdit"/>
|
||||||
|
</Item24>
|
||||||
|
<Item25>
|
||||||
|
<Filename Value="src/jfloatedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JFloatEdit"/>
|
||||||
|
</Item25>
|
||||||
|
<Item26>
|
||||||
|
<Filename Value="src/jcurrencyedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<AddToUsesPkgSection Value="False"/>
|
||||||
|
<UnitName Value="jcurrencyedit"/>
|
||||||
|
</Item26>
|
||||||
|
<Item27>
|
||||||
|
<Filename Value="src/jdateedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JDateEdit"/>
|
||||||
|
</Item27>
|
||||||
|
<Item28>
|
||||||
|
<Filename Value="src/jtimeedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JTimeEdit"/>
|
||||||
|
</Item28>
|
||||||
|
<Item29>
|
||||||
|
<Filename Value="src/jdatetimeedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JDateTimeEdit"/>
|
||||||
|
</Item29>
|
||||||
|
<Item30>
|
||||||
|
<Filename Value="src/jdbedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JDBEdit"/>
|
||||||
|
</Item30>
|
||||||
|
<Item31>
|
||||||
|
<Filename Value="src/jdbintegeredit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="jdbintegeredit"/>
|
||||||
|
</Item31>
|
||||||
|
<Item32>
|
||||||
|
<Filename Value="src/jdbfloatedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JDBFloatEdit"/>
|
||||||
|
</Item32>
|
||||||
|
<Item33>
|
||||||
|
<Filename Value="src/jdbcurrencyedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="jdbcurrencyedit"/>
|
||||||
|
</Item33>
|
||||||
|
<Item34>
|
||||||
|
<Filename Value="src/jdbdateedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="jdbdateedit"/>
|
||||||
|
</Item34>
|
||||||
|
<Item35>
|
||||||
|
<Filename Value="src/jdbtimeedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JDBTimeEdit"/>
|
||||||
|
</Item35>
|
||||||
|
<Item36>
|
||||||
|
<Filename Value="src/jdbdatetimeedit.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="JDBDateTimeEdit"/>
|
||||||
|
</Item36>
|
||||||
</Files>
|
</Files>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N Value="True"/>
|
<EnableI18N Value="True"/>
|
||||||
<OutDir Value="languages"/>
|
<OutDir Value="languages"/>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
unit jujiboutils;
|
unit jujiboutils;
|
||||||
|
|
||||||
|
{$warn 5023 off : no warning about unused units}
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -12,7 +13,10 @@ uses
|
|||||||
JLabeledIntegerEdit, JLabeledFloatEdit, JLabeledCurrencyEdit,
|
JLabeledIntegerEdit, JLabeledFloatEdit, JLabeledCurrencyEdit,
|
||||||
JLabeledDateEdit, jdbgridutils, JLabeledTimeEdit, JDBLabeledTimeEdit,
|
JLabeledDateEdit, jdbgridutils, JLabeledTimeEdit, JDBLabeledTimeEdit,
|
||||||
JLabeledDateTimeEdit, JDBLabeledDateTimeEdit, jinputconsts, JDbEnumCombo,
|
JLabeledDateTimeEdit, JDBLabeledDateTimeEdit, jinputconsts, JDbEnumCombo,
|
||||||
JDBImageBlob, JLabel, JDbLabel, JButton, jdbutils, LazarusPackageIntf;
|
JDBImageBlob, JLabel, JDbLabel, JButton, jdbutils, JIntegerEdit, JFloatEdit,
|
||||||
|
JCurrencyEdit, JDateEdit, JTimeEdit, JDateTimeEdit, JDBEdit, jdbintegeredit,
|
||||||
|
JDBFloatEdit, jdbcurrencyedit, jdbdateedit, JDBTimeEdit, JDBDateTimeEdit,
|
||||||
|
LazarusPackageIntf;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -37,6 +41,19 @@ begin
|
|||||||
RegisterUnit('JLabel', @JLabel.Register);
|
RegisterUnit('JLabel', @JLabel.Register);
|
||||||
RegisterUnit('JDbLabel', @JDbLabel.Register);
|
RegisterUnit('JDbLabel', @JDbLabel.Register);
|
||||||
RegisterUnit('JButton', @JButton.Register);
|
RegisterUnit('JButton', @JButton.Register);
|
||||||
|
RegisterUnit('JIntegerEdit', @JIntegerEdit.Register);
|
||||||
|
RegisterUnit('JFloatEdit', @JFloatEdit.Register);
|
||||||
|
RegisterUnit('JCurrencyEdit', @JCurrencyEdit.Register);
|
||||||
|
RegisterUnit('JDateEdit', @JDateEdit.Register);
|
||||||
|
RegisterUnit('JTimeEdit', @JTimeEdit.Register);
|
||||||
|
RegisterUnit('JDateTimeEdit', @JDateTimeEdit.Register);
|
||||||
|
RegisterUnit('JDBEdit', @JDBEdit.Register);
|
||||||
|
RegisterUnit('jdbintegeredit', @jdbintegeredit.Register);
|
||||||
|
RegisterUnit('JDBFloatEdit', @JDBFloatEdit.Register);
|
||||||
|
RegisterUnit('jdbcurrencyedit', @jdbcurrencyedit.Register);
|
||||||
|
RegisterUnit('jdbdateedit', @jdbdateedit.Register);
|
||||||
|
RegisterUnit('JDBTimeEdit', @JDBTimeEdit.Register);
|
||||||
|
RegisterUnit('JDBDateTimeEdit', @JDBDateTimeEdit.Register);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
{ JDBLabeledTimeEdit
|
||||||
|
|
||||||
|
Copyright (C) 2011 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 JDBLabeledTimeEdit;
|
unit JDBLabeledTimeEdit;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
@ -40,6 +40,7 @@ type
|
|||||||
function getDecimals: integer;
|
function getDecimals: integer;
|
||||||
function getFormat: string;
|
function getFormat: string;
|
||||||
function getValue: currency;
|
function getValue: currency;
|
||||||
|
function getCurrentValue: Currency;
|
||||||
procedure formatInput;
|
procedure formatInput;
|
||||||
procedure setDecimals(const AValue: integer);
|
procedure setDecimals(const AValue: integer);
|
||||||
procedure setFormat(const AValue: string);
|
procedure setFormat(const AValue: string);
|
||||||
@ -54,6 +55,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property CurrentValue: currency read getCurrentValue;
|
||||||
published
|
published
|
||||||
property DisplayFormat: string read getFormat write setFormat;
|
property DisplayFormat: string read getFormat write setFormat;
|
||||||
property EditFormat: string read fEFormat write fEFormat;
|
property EditFormat: string read fEFormat write fEFormat;
|
||||||
@ -140,6 +142,11 @@ begin
|
|||||||
Result := theValue;
|
Result := theValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TJLabeledCurrencyEdit.getCurrentValue: Currency;
|
||||||
|
begin
|
||||||
|
Result := StrToCurrDef(Text, Value);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJLabeledCurrencyEdit.formatInput;
|
procedure TJLabeledCurrencyEdit.formatInput;
|
||||||
begin
|
begin
|
||||||
if Font.Color <> fNColor then
|
if Font.Color <> fNColor then
|
||||||
|
@ -39,6 +39,7 @@ type
|
|||||||
function GetButtonWidth: integer;
|
function GetButtonWidth: integer;
|
||||||
function getFormat: string;
|
function getFormat: string;
|
||||||
function getValue: TDateTime;
|
function getValue: TDateTime;
|
||||||
|
function getCurrentValue: TDateTime;
|
||||||
procedure formatInput;
|
procedure formatInput;
|
||||||
procedure SetButtonWidth(AValue: integer);
|
procedure SetButtonWidth(AValue: integer);
|
||||||
procedure setFormat(const AValue: string);
|
procedure setFormat(const AValue: string);
|
||||||
@ -63,6 +64,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property CurrentValue: TDateTime read getCurrentValue;
|
||||||
published
|
published
|
||||||
function isNull: boolean;
|
function isNull: boolean;
|
||||||
property DisplayFormat: string read getFormat write setFormat;
|
property DisplayFormat: string read getFormat write setFormat;
|
||||||
@ -146,6 +148,21 @@ begin
|
|||||||
Result := theValue;
|
Result := theValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TJLabeledDateEdit.getCurrentValue: TDateTime;
|
||||||
|
var
|
||||||
|
aText: string;
|
||||||
|
aValue: TDateTime;
|
||||||
|
begin
|
||||||
|
aText := NormalizeDate(Text, theValue);
|
||||||
|
if Length(aText) = 0 then
|
||||||
|
aValue := 0
|
||||||
|
else
|
||||||
|
if not ValidateDateString(aText, aValue) then
|
||||||
|
Result:= Value
|
||||||
|
else
|
||||||
|
Result:= aValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJLabeledDateEdit.formatInput;
|
procedure TJLabeledDateEdit.formatInput;
|
||||||
begin
|
begin
|
||||||
if theValue <> 0 then
|
if theValue <> 0 then
|
||||||
|
@ -41,6 +41,7 @@ type
|
|||||||
function GetButtonWidth: integer;
|
function GetButtonWidth: integer;
|
||||||
function getFormat: string;
|
function getFormat: string;
|
||||||
function getValue: TDateTime;
|
function getValue: TDateTime;
|
||||||
|
function getCurrentValue: TDateTime;
|
||||||
procedure formatInput;
|
procedure formatInput;
|
||||||
procedure SetButtonWidth(AValue: integer);
|
procedure SetButtonWidth(AValue: integer);
|
||||||
procedure setFormat(const AValue: string);
|
procedure setFormat(const AValue: string);
|
||||||
@ -66,6 +67,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property CurrentValue: TDateTime read getCurrentValue;
|
||||||
published
|
published
|
||||||
function isNull: boolean;
|
function isNull: boolean;
|
||||||
property DisplayFormat: string read getFormat write setFormat;
|
property DisplayFormat: string read getFormat write setFormat;
|
||||||
@ -150,6 +152,24 @@ begin
|
|||||||
Result := theValue;
|
Result := theValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TJLabeledDateTimeEdit.getCurrentValue: TDateTime;
|
||||||
|
var
|
||||||
|
aText: string;
|
||||||
|
aValue: TDateTime;
|
||||||
|
begin
|
||||||
|
aText := NormalizeDateTime(Text, theValue);
|
||||||
|
if Length(aText) = 0 then
|
||||||
|
aValue := 0
|
||||||
|
else
|
||||||
|
if IsValidDateTimeString(aText) then
|
||||||
|
aValue := StrToDateTime(aText)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
aValue:= Value;
|
||||||
|
end;
|
||||||
|
Result:= aValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJLabeledDateTimeEdit.formatInput;
|
procedure TJLabeledDateTimeEdit.formatInput;
|
||||||
begin
|
begin
|
||||||
if theValue <> 0 then
|
if theValue <> 0 then
|
||||||
|
@ -26,6 +26,9 @@ uses
|
|||||||
Dialogs, jcontrolutils, jinputconsts;
|
Dialogs, jcontrolutils, jinputconsts;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TJLabeledTimeEdit }
|
||||||
|
|
||||||
TJLabeledTimeEdit = class(TCustomLabeledEdit)
|
TJLabeledTimeEdit = class(TCustomLabeledEdit)
|
||||||
private
|
private
|
||||||
theValue: TTime;
|
theValue: TTime;
|
||||||
@ -33,6 +36,7 @@ type
|
|||||||
fFormat: string;
|
fFormat: string;
|
||||||
function getFormat: string;
|
function getFormat: string;
|
||||||
function getValue: TTime;
|
function getValue: TTime;
|
||||||
|
function getCurrentValue: TTime;
|
||||||
procedure setFormat(const AValue: string);
|
procedure setFormat(const AValue: string);
|
||||||
procedure setValue(const AValue: TTime);
|
procedure setValue(const AValue: TTime);
|
||||||
procedure FormatInput;
|
procedure FormatInput;
|
||||||
@ -43,6 +47,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property CurrentValue: TTime read getCurrentValue;
|
||||||
published
|
published
|
||||||
function isNull: boolean;
|
function isNull: boolean;
|
||||||
property DisplayFormat: string read getFormat write setFormat;
|
property DisplayFormat: string read getFormat write setFormat;
|
||||||
@ -118,6 +123,28 @@ begin
|
|||||||
Result := theValue;
|
Result := theValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TJLabeledTimeEdit.getCurrentValue: TTime;
|
||||||
|
var
|
||||||
|
aText: string;
|
||||||
|
aValue: TTime;
|
||||||
|
begin
|
||||||
|
aText := NormalizeTime(Text, theValue);
|
||||||
|
if Length(aText) = 0 then
|
||||||
|
begin
|
||||||
|
aValue := 0;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if IsValidTimeString(aText) then
|
||||||
|
begin
|
||||||
|
aValue := StrToTime(aText);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
aValue := Value;
|
||||||
|
end;
|
||||||
|
Result:= aValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJLabeledTimeEdit.setFormat(const AValue: string);
|
procedure TJLabeledTimeEdit.setFormat(const AValue: string);
|
||||||
begin
|
begin
|
||||||
fFormat := AValue;
|
fFormat := AValue;
|
||||||
|
Reference in New Issue
Block a user