jvcllaz: Add TJvValidateEdit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6665 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-09-28 21:40:42 +00:00
parent 50bdee57de
commit f9640cf3bc
10 changed files with 1912 additions and 14 deletions

View File

@ -1,7 +1,9 @@
tjvtabbar.bmp tjvtabbar.bmp
tjvmoderntabbarpainter.bmp tjvmoderntabbarpainter.bmp
Tjvtabbarxppainter.bmp Tjvtabbarxppainter.bmp
tjvoutlookbar.bmp tjvoutlookbar.png
tjvoutlookbar_150.png
tjvoutlookbar_200.png
tjvtimeline.png tjvtimeline.png
tjvtimeline_150.png tjvtimeline_150.png
tjvtimeline_200.png tjvtimeline_200.png
@ -26,3 +28,6 @@ tjvimagesviewer_200.png
tjvownerdrawviewer.png tjvownerdrawviewer.png
tjvownerdrawviewer_150.png tjvownerdrawviewer_150.png
tjvownerdrawviewer_200.png tjvownerdrawviewer_200.png
tjvvalidateedit.png
tjvvalidateedit_150.png
tjvvalidateedit_200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -16,6 +16,7 @@ implementation
uses uses
Classes, ImgList, Controls, LResources, PropEdits, GraphPropEdits, ComponentEditors, Classes, ImgList, Controls, LResources, PropEdits, GraphPropEdits, ComponentEditors,
JvDsgnConsts, JvDsgnConsts,
JvValidateEdit,
JvOutlookBar, JvOutlookBarEditors, JvOutlookBar, JvOutlookBarEditors,
// JvTabBar, JvTabBarXPPainter, // JvTabBar, JvTabBarXPPainter,
JvThumbImage, JvThumbnails, JvThumbViews, JvThumbImage, JvThumbnails, JvThumbViews,
@ -25,6 +26,7 @@ uses
procedure Register; procedure Register;
begin begin
RegisterComponents(RsPaletteJvcl, [ RegisterComponents(RsPaletteJvcl, [
TJvValidateEdit,
// TJvTabBar, TJvModernTabBarPainter, TJvTabBarXPPainter, // moved to PageComps // TJvTabBar, TJvModernTabBarPainter, TJvTabBarXPPainter, // moved to PageComps
TJvOutlookBar, TJvOutlookBar,
TJvThumbView, TJvThumbnail, TJvThumbImage, TJvThumbView, TJvThumbnail, TJvThumbImage,

View File

@ -39,7 +39,7 @@
<UnitName Value="JvOutlookBarForm"/> <UnitName Value="JvOutlookBarForm"/>
</Item4> </Item4>
</Files> </Files>
<RequiredPkgs Count="4"> <RequiredPkgs Count="3">
<Item1> <Item1>
<PackageName Value="IDEIntf"/> <PackageName Value="IDEIntf"/>
</Item1> </Item1>
@ -49,9 +49,6 @@
<Item3> <Item3>
<PackageName Value="JvCustomLazR"/> <PackageName Value="JvCustomLazR"/>
</Item3> </Item3>
<Item4>
<PackageName Value="FCL"/>
</Item4>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>
<UnitPath Value="$(PkgOutDir)"/> <UnitPath Value="$(PkgOutDir)"/>

View File

@ -19,7 +19,7 @@
"/> "/>
<License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/> <License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/>
<Version Major="1" Release="4"/> <Version Major="1" Release="4"/>
<Files Count="11"> <Files Count="12">
<Item1> <Item1>
<Filename Value="..\run\JvCustomControls\jvtimeline.pas"/> <Filename Value="..\run\JvCustomControls\jvtimeline.pas"/>
<UnitName Value="JvTimeLine"/> <UnitName Value="JvTimeLine"/>
@ -64,6 +64,10 @@
<Filename Value="..\run\JvCustomControls\jvownerdrawviewer.pas"/> <Filename Value="..\run\JvCustomControls\jvownerdrawviewer.pas"/>
<UnitName Value="JvOwnerDrawViewer"/> <UnitName Value="JvOwnerDrawViewer"/>
</Item11> </Item11>
<Item12>
<Filename Value="..\run\JvCustomControls\jvvalidateedit.pas"/>
<UnitName Value="jvvalidateedit"/>
</Item12>
</Files> </Files>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">
<Item1> <Item1>

View File

@ -46,7 +46,8 @@ interface
// the JCL has the same problem with CLX it should not make any difference. // the JCL has the same problem with CLX it should not make any difference.
uses uses
Classes, Graphics, LCLIntf, LCLType; LCLIntf, LCLType,
SysUtils, Classes, Graphics;
const const
(******************** NOT CONVERTED (******************** NOT CONVERTED
@ -69,14 +70,15 @@ const
BOM_LSB_FIRST = WideChar($FEFF); BOM_LSB_FIRST = WideChar($FEFF);
BOM_MSB_FIRST = WideChar($FFFE); BOM_MSB_FIRST = WideChar($FFFE);
{$IF FPC_FullVersion < 30000}
type type
{$IF FPC_FullVersion < 30000}
TSysCharSet = set of AnsiChar; TSysCharSet = set of AnsiChar;
{$ENDIF} {$ENDIF}
EJvConvertError = Class(EConvertError); { subclass EConvertError raised by some non-Def versions of floating point conversion routine }
(******************** NOT CONVERTED (******************** NOT CONVERTED
{$IFDEF UNIX} {$IFDEF UNIX}
type
TFileTime = Integer; TFileTime = Integer;
{$ENDIF UNIX} {$ENDIF UNIX}
@ -90,7 +92,12 @@ const
DefaultDateOrder = doDMY; DefaultDateOrder = doDMY;
CenturyOffset: Byte = 60; CenturyOffset: Byte = 60;
NullDate: TDateTime = {-693594} 0; NullDate: TDateTime = {-693594} 0;
*)
function JvSafeStrToFloatDef(const Str: string; Def: Extended; aDecimalSeparator: Char): Extended;
function JvSafeStrToFloat(const Str: string; aDecimalSeparator: Char): Extended;
(******************* NOT CONVERTED ******
function USToLocalFloatStr(const Text: string): string; function USToLocalFloatStr(const Text: string): string;
function StrToFloatUS(const Text: string): Extended; function StrToFloatUS(const Text: string): Extended;
// StrToFloatUS uses US '.' as decimal seperator and ',' as thousand separator // StrToFloatUS uses US '.' as decimal seperator and ',' as thousand separator
@ -292,6 +299,15 @@ function CopyDir(const SourceDir, DestDir: TFileName): Boolean;
//function FileTimeToDateTime(const FT: TFileTime): TDateTime; //function FileTimeToDateTime(const FT: TFileTime): TDateTime;
procedure FileTimeToDosDateTimeDWord(const FT: TFileTime; out Dft: DWORD); procedure FileTimeToDosDateTimeDWord(const FT: TFileTime; out Dft: DWORD);
function MakeValidFileName(const FileName: TFileName; ReplaceBadChar: Char): TFileName; function MakeValidFileName(const FileName: TFileName; ReplaceBadChar: Char): TFileName;
***)
function StrEnsureNoPrefix(const Prefix, Text: string): string;
function StrEnsureNoSuffix(const Suffix, Text: string): string;
function IsCharAlpha(Key: Char): Boolean;
function IsCharAlphaNumeric(Key: Char): Boolean;
(******************** NOT CONVERTED ***
{**** Graphic routines } {**** Graphic routines }
@ -844,9 +860,10 @@ function IntToExtended(I: Integer): Extended;
It is not very useful in other contexts, It is not very useful in other contexts,
but it is in this unit as it is needed in both MemoEx and TypedEdit } but it is in this unit as it is needed in both MemoEx and TypedEdit }
function GetChangedText(const Text: string; SelStart, SelLength: Integer; Key: Char): string; function GetChangedText(const Text: string; SelStart, SelLength: Integer; Key: Char): string;
*)
function MakeYear4Digit(Year, Pivot: Integer): Integer; function MakeYear4Digit(Year, Pivot: Integer): Integer;
(********************** NOT CONVERTED ***
function StrIsInteger(const S: string): Boolean; function StrIsInteger(const S: string): Boolean;
function StrIsFloatMoney(const Ps: string): Boolean; function StrIsFloatMoney(const Ps: string): Boolean;
function StrIsDateTime(const Ps: string): Boolean; function StrIsDateTime(const Ps: string): Boolean;
@ -1233,7 +1250,7 @@ function FindUnusedFileName(FileName: string; const FileExt: string; NumberPrefi
implementation implementation
uses uses
Math, SysUtils, LazFileUtils, Math, LazFileUtils, LclStrConsts,
JvConsts; JvConsts;
(******************** NOT CONVERTED (******************** NOT CONVERTED
@ -1265,12 +1282,15 @@ const
RC_ShellName = 'Shell_TrayWnd'; RC_ShellName = 'Shell_TrayWnd';
RC_DefaultIcon = 'DefaultIcon'; RC_DefaultIcon = 'DefaultIcon';
{$ENDIF MSWINDOWS} {$ENDIF MSWINDOWS}
********************)
resourcestring resourcestring
RsEPivotLessThanZero = 'JvJCLUtils.MakeYear4Digit: Pivot < 0';
(******************* NOT CONVERTED ****
// (p3) duplicated from JvConsts since this unit should not rely on JVCL at all // (p3) duplicated from JvConsts since this unit should not rely on JVCL at all
RsEPropertyNotExists = 'Property "%s" does not exist'; RsEPropertyNotExists = 'Property "%s" does not exist';
RsEInvalidPropertyType = 'Property "%s" has invalid type'; RsEInvalidPropertyType = 'Property "%s" has invalid type';
RsEPivotLessThanZero = 'JvJCLUtils.MakeYear4Digit: Pivot < 0';
{$IFDEF NO_JCL} {$IFDEF NO_JCL}
@ -1506,7 +1526,56 @@ begin
Result := StrToFloat(Text); // try it with local settings Result := StrToFloat(Text); // try it with local settings
end; end;
end; end;
**********)
{ JvStrConvertErrorFmt used from JvSafeStrToFloat }
procedure JvStrConvertErrorFmt(ResString: PResStringRec; const Args: array of const);
begin
raise EJvConvertError.CreateResFmt(ResString, Args); { will be also caught if you catch E:EConvertERror }
end;
function _JvSafeStrToFloat(const Str: String; aDecimalSeparator: Char; out AValue: Extended): Boolean;
var
LocalFormatSettings: TFormatSettings;
begin
Result := false;
if Str = '' then
Exit; { how's this for a nice optimization? WPostma. }
LocalFormatSettings := FormatSettings;
if aDecimalSeparator = ' ' then
LocalFormatSettings.DecimalSeparator := FormatSettings.DecimalSeparator
else
LocalFormatSettings.DecimalSeparator := aDecimalSeparator;
{ Cross-codepage safety feature: Handed '1.2', a string without a comma,
but which is obviously a floating point number, convert it properly also.
This functionality is important for JvCsvDataSet and may be important in other
places. }
if (Pos(USDecimalSeparator, Str) > 0) and (Pos(ADecimalSeparator, Str) = 0) then
LocalFormatSettings.DecimalSeparator := USDecimalSeparator;
Result := TryStrToFloat(Str, AValue, LocalFormatSettings);
end;
function JvSafeStrToFloatDef(const Str: string; Def: Extended; aDecimalSeparator: Char): Extended;
begin
{ one handy dandy api expects a Default value returned instead }
if not _JvSafeStrToFloat(Str, aDecimalSeparator, Result) then
Result := Def; { failed, use default }
end;
// New routine, same as JvSafeStrToFloatDef but it will raise a conversion exception,
// for cases when you actually want to handle an EConvertError yourself and where
// there is no convenient or possible float value for your case.
function JvSafeStrToFloat(const Str: string; aDecimalSeparator: Char): Extended;
begin
{ the other handy dandy api style expects us to raise an EConvertError. }
if not _JvSafeStrToFloat(Str, aDecimalSeparator, Result) then
JvStrConvertErrorFmt(@SParInvalidFloat, [Str]); {failed, raise exception }
end;
(******************** NOT CONVERTED ***
function StrToFloatUSDef(const Text: string; Default: Extended): Extended; function StrToFloatUSDef(const Text: string; Default: Extended): Extended;
begin begin
Result := StrToFloatDef(USToLocalFloatStr(Text), Default); Result := StrToFloatDef(USToLocalFloatStr(Text), Default);
@ -3162,6 +3231,45 @@ function StrToBool(const S: string): Boolean;
begin begin
Result := (S = '1') or SameText(S, 'True') or SameText(S, 'yes'); Result := (S = '1') or SameText(S, 'True') or SameText(S, 'yes');
end; end;
**********)
function StrEnsureNoPrefix(const Prefix, Text: string): string;
var
PrefixLen: SizeInt;
begin
PrefixLen := Length(Prefix);
if Copy(Text, 1, PrefixLen) = Prefix then
Result := Copy(Text, PrefixLen + 1, Length(Text))
else
Result := Text;
end;
function StrEnsureNoSuffix(const Suffix, Text: string): string;
var
SuffixLen: SizeInt;
StrLength: SizeInt;
begin
SuffixLen := Length(Suffix);
StrLength := Length(Text);
if Copy(Text, StrLength - SuffixLen + 1, SuffixLen) = Suffix then
Result := Copy(Text, 1, StrLength - SuffixLen)
else
Result := Text;
end;
// Laz workaround for Windows function --- probably not complete...
function IsCharAlpha(Key: Char): Boolean;
begin
Result := Key in ['a'..'z', 'A'..'Z'];
end;
// Laz workaround for Windows function --- probably not complete...
function IsCharAlphaNumeric(Key: Char): Boolean;
begin
Result := Key in ['0'..'9', 'a'..'z', 'A'..'Z'];
end;
(********************** NOT CONVERTED ***
function RATextOutEx(Canvas: TCanvas; const R, RClip: TRect; const S: string; function RATextOutEx(Canvas: TCanvas; const R, RClip: TRect; const S: string;
const CalcHeight: Boolean): Integer; const CalcHeight: Boolean): Integer;
@ -7921,6 +8029,7 @@ begin
if Key <> #0 then if Key <> #0 then
Insert(Key, Result, SelStart + 1); Insert(Key, Result, SelStart + 1);
end; end;
****************)
{ "window" technique for years to translate 2 digits to 4 digits. { "window" technique for years to translate 2 digits to 4 digits.
The window is 100 years wide The window is 100 years wide
@ -7974,6 +8083,7 @@ begin
Result := Year; Result := Year;
end; end;
(*********************
function StrIsInteger(const S: string): Boolean; function StrIsInteger(const S: string): Boolean;
var var
I: Integer; I: Integer;

File diff suppressed because it is too large Load Diff