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:
jujibo
2022-06-14 10:17:55 +00:00
parent b2d2f2fb63
commit 362e9c6056
7 changed files with 176 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<Package Version="5">
<Name Value="jujiboutils"/>
<Type Value="RunAndDesignTime"/>
<Author Value="Julio Jiménez Borreguero"/>
@ -15,8 +15,8 @@
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="2" Minor="4"/>
<Files Count="23">
<Version Major="2" Minor="5"/>
<Files Count="36">
<Item1>
<Filename Value="src/jcontrolutils.pas"/>
<UnitName Value="jcontrolutils"/>
@ -128,7 +128,74 @@ db and non db controls."/>
<Filename Value="src/jdbutils.pas"/>
<UnitName Value="jdbutils"/>
</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>
<CompatibilityMode Value="True"/>
<i18n>
<EnableI18N Value="True"/>
<OutDir Value="languages"/>

View File

@ -4,6 +4,7 @@
unit jujiboutils;
{$warn 5023 off : no warning about unused units}
interface
uses
@ -12,7 +13,10 @@ uses
JLabeledIntegerEdit, JLabeledFloatEdit, JLabeledCurrencyEdit,
JLabeledDateEdit, jdbgridutils, JLabeledTimeEdit, JDBLabeledTimeEdit,
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
@ -37,6 +41,19 @@ begin
RegisterUnit('JLabel', @JLabel.Register);
RegisterUnit('JDbLabel', @JDbLabel.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;
initialization

View File

@ -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;
{$mode objfpc}{$H+}

View File

@ -40,6 +40,7 @@ type
function getDecimals: integer;
function getFormat: string;
function getValue: currency;
function getCurrentValue: Currency;
procedure formatInput;
procedure setDecimals(const AValue: integer);
procedure setFormat(const AValue: string);
@ -54,6 +55,7 @@ type
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
property CurrentValue: currency read getCurrentValue;
published
property DisplayFormat: string read getFormat write setFormat;
property EditFormat: string read fEFormat write fEFormat;
@ -140,6 +142,11 @@ begin
Result := theValue;
end;
function TJLabeledCurrencyEdit.getCurrentValue: Currency;
begin
Result := StrToCurrDef(Text, Value);
end;
procedure TJLabeledCurrencyEdit.formatInput;
begin
if Font.Color <> fNColor then

View File

@ -39,6 +39,7 @@ type
function GetButtonWidth: integer;
function getFormat: string;
function getValue: TDateTime;
function getCurrentValue: TDateTime;
procedure formatInput;
procedure SetButtonWidth(AValue: integer);
procedure setFormat(const AValue: string);
@ -63,6 +64,7 @@ type
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
property CurrentValue: TDateTime read getCurrentValue;
published
function isNull: boolean;
property DisplayFormat: string read getFormat write setFormat;
@ -146,6 +148,21 @@ begin
Result := theValue;
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;
begin
if theValue <> 0 then

View File

@ -41,6 +41,7 @@ type
function GetButtonWidth: integer;
function getFormat: string;
function getValue: TDateTime;
function getCurrentValue: TDateTime;
procedure formatInput;
procedure SetButtonWidth(AValue: integer);
procedure setFormat(const AValue: string);
@ -66,6 +67,7 @@ type
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
property CurrentValue: TDateTime read getCurrentValue;
published
function isNull: boolean;
property DisplayFormat: string read getFormat write setFormat;
@ -150,6 +152,24 @@ begin
Result := theValue;
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;
begin
if theValue <> 0 then

View File

@ -26,6 +26,9 @@ uses
Dialogs, jcontrolutils, jinputconsts;
type
{ TJLabeledTimeEdit }
TJLabeledTimeEdit = class(TCustomLabeledEdit)
private
theValue: TTime;
@ -33,6 +36,7 @@ type
fFormat: string;
function getFormat: string;
function getValue: TTime;
function getCurrentValue: TTime;
procedure setFormat(const AValue: string);
procedure setValue(const AValue: TTime);
procedure FormatInput;
@ -43,6 +47,7 @@ type
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
property CurrentValue: TTime read getCurrentValue;
published
function isNull: boolean;
property DisplayFormat: string read getFormat write setFormat;
@ -118,6 +123,28 @@ begin
Result := theValue;
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);
begin
fFormat := AValue;