Fixing deprecated code

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4492 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2016-02-11 09:35:02 +00:00
parent 92b7929557
commit 61c30095ef
10 changed files with 74 additions and 65 deletions

View File

@ -77,7 +77,8 @@ var
ms := tokens[1];
if (tokens.Count > 2) and (tokens[2] <> '') then
ys := tokens[2];
texto := ds + DateSeparator + ms + DateSeparator + ys;
texto := ds + DefaultFormatSettings.DateSeparator + ms +
DefaultFormatSettings.DateSeparator + ys;
end;
procedure MiddleEndianForm;
@ -88,7 +89,8 @@ var
ds := tokens[1];
if (tokens.Count > 2) and (tokens[2] <> '') then
ys := tokens[2];
texto := ms + DateSeparator + ds + DateSeparator + ys;
texto := ms + DefaultFormatSettings.DateSeparator + ds +
DefaultFormatSettings.DateSeparator + ys;
end;
procedure BigEndianForm;
@ -99,12 +101,13 @@ var
ms := tokens[1];
if (tokens.Count > 2) and (tokens[2] <> '') then
ds := tokens[2];
texto := ys + DateSeparator + ms + DateSeparator + ds;
texto := ys + DefaultFormatSettings.DateSeparator + ms +
DefaultFormatSettings.DateSeparator + ds;
end;
begin
if theFormat = '' then
aDateFormat := ShortDateFormat
aDateFormat := DefaultFormatSettings.ShortDateFormat
else
aDateFormat := theFormat;
if theValue = 0 then
@ -118,7 +121,7 @@ begin
texto := NormalizeDateSeparator(texto);
Result := texto; // default value
tokens := TStringList.Create;
Split(DateSeparator, texto, tokens);
Split(DefaultFormatSettings.DateSeparator, texto, tokens);
if tokens.Count > 0 then
begin
aChar := aDateFormat[1];
@ -149,7 +152,8 @@ var
function TimeString: string;
begin
Result := hhs + TimeSeparator + mms + TimeSeparator + sss;// + TimeSeparator + mss;
Result := hhs + DefaultFormatSettings.TimeSeparator + mms +
DefaultFormatSettings.TimeSeparator + sss;// + TimeSeparator + mss;
end;
procedure TimeForm;
@ -167,7 +171,7 @@ var
begin
if theFormat = '' then
aTimeFormat := ShortTimeFormat
aTimeFormat := DefaultFormatSettings.ShortTimeFormat
else
aTimeFormat := theFormat;
if theValue = 0 then
@ -186,7 +190,7 @@ begin
texto := Value;
Result := texto; // default value
tokens := TStringList.Create;
Split(TimeSeparator, texto, tokens);
Split(DefaultFormatSettings.TimeSeparator, texto, tokens);
if tokens.Count > 0 then
begin
TimeForm;
@ -194,7 +198,7 @@ begin
begin
aTime := StrToTime(texto);
Result := TimeString;// FormatDateTime(aTimeFormat, aTime);
end
end;
end;
tokens.Free;
//ShowMessage('Hora normalizada: ' + Result);
@ -235,7 +239,7 @@ begin
Result := s;
for i := 1 to length(Result) do
if Result[i] in ['.', ',', '/', '-'] then // valid date separators
Result[i] := DateSeparator;
Result[i] := DefaultFormatSettings.DateSeparator;
end;
function IsValidDateString(const Value: string): boolean;
@ -283,7 +287,5 @@ initialization
+ #212#8#146#188#183#154'U1'#250#167#224#238#140#29#223#207'i'#173#222#190#247
+ #254#194'n'#203#204#173#246#144#252#237#221#133#213#179'A'#173'-Q'#145#168'h'
+ '4D'#141#168'qW'#192#230#214#239#231#0#217'^'#191#243#31#2'<4&'#179'.'#211
+#208#0#0#0#0'IEND'#174'B`'#130
]);
+ #208#0#0#0#0'IEND'#174'B`'#130]);
end.

View File

@ -313,8 +313,8 @@ begin
if Field.IsNull then
Result := ''
else
Result := FormatDateTime(ShortDateFormat, Field.AsDateTime) +
' ' + FormatDateTime(ShortTimeFormat, Field.AsDateTime);
Result := FormatDateTime(DefaultFormatSettings.ShortDateFormat, Field.AsDateTime) +
' ' + FormatDateTime(DefaultFormatSettings.ShortTimeFormat, Field.AsDateTime);
end;
procedure TJDbGridDateTimeCtrl.myEditEnter(Sender: TObject);
@ -510,7 +510,8 @@ begin
CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.OnEditingDone := @myEditOnEditingDone;
CellEditor.OnKeyPress := @OnKeyPress;
DisplayFormat := ShortDateFormat + ' ' + ShortTimeFormat;
DisplayFormat := DefaultFormatSettings.ShortDateFormat + ' ' +
DefaultFormatSettings.ShortTimeFormat;
end;
destructor TJDbGridDateTimeCtrl.Destroy;
@ -704,7 +705,7 @@ begin
CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.OnEditingDone := @myEditOnEditingDone;
CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :(
DisplayFormat := ShortTimeFormat;
DisplayFormat := DefaultFormatSettings.ShortTimeFormat;
end;
destructor TJDbGridTimeCtrl.Destroy;
@ -937,7 +938,7 @@ begin
CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.OnEditingDone := @myEditOnEditingDone;
CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :(
DisplayFormat := ShortDateFormat;
DisplayFormat := DefaultFormatSettings.ShortDateFormat;
end;
destructor TJDbGridDateCtrl.Destroy;
@ -1035,10 +1036,12 @@ end;
procedure TJDbGridDoubleCtrl.OnKeyPress(Sender: TObject; var key: char);
begin
if (Key in ['.', ',']) then
Key := Decimalseparator;
if (key = DecimalSeparator) and (Pos(key, CellEditor.Caption) > 0) then
Key := DefaultFormatSettings.Decimalseparator;
if (key = DefaultFormatSettings.DecimalSeparator) and
(Pos(key, CellEditor.Caption) > 0) then
key := #0;
if not (Key in ['0'..'9', DecimalSeparator, '+', '-', #8, #9]) then
if not (Key in ['0'..'9', DefaultFormatSettings.DecimalSeparator,
'+', '-', #8, #9]) then
Key := #0;
//if (Key = DecimalSeparator) and (fDecimals = 0) then
// Key := #0; // Note: decimal=0 avoids rounding

View File

@ -350,10 +350,11 @@ 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
Key := DefaultFormatSettings.Decimalseparator;
if (key = DefaultFormatSettings.DecimalSeparator) and (Pos(key, Text) > 0) then
key := #0;
if not (Key in ['0'..'9', DecimalSeparator, '+', '-', #8, #9]) then
if not (Key in ['0'..'9', DefaultFormatSettings.DecimalSeparator,
'+', '-', #8, #9]) then
Key := #0;
if (Key <> #0) and (not IsReadOnly) then
@ -403,4 +404,3 @@ begin
end;
end.

View File

@ -249,8 +249,9 @@ begin
if Field.IsNull then
Result := ''
else
Result := FormatDateTime(ShortDateFormat, FDataLink.Field.AsDateTime) +
' ' + FormatDateTime(ShortTimeFormat, FDataLink.Field.AsDateTime);
Result := FormatDateTime(DefaultFormatSettings.ShortDateFormat,
FDataLink.Field.AsDateTime) + ' ' +
FormatDateTime(DefaultFormatSettings.ShortTimeFormat, FDataLink.Field.AsDateTime);
end;
function TJDBLabeledDateTimeEdit.getFormat: string;

View File

@ -360,10 +360,11 @@ 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
Key := DefaultFormatSettings.Decimalseparator;
if (key = DefaultFormatSettings.DecimalSeparator) and (Pos(key, Text) > 0) then
key := #0;
if not (Key in ['0'..'9', DecimalSeparator, '+', '-', #8, #9]) then
if not (Key in ['0'..'9', DefaultFormatSettings.DecimalSeparator,
'+', '-', #8, #9]) then
Key := #0;
if (Key <> #0) and (not IsReadOnly) then
FDatalink.Edit;
@ -417,4 +418,3 @@ end;
end.

View File

@ -42,7 +42,6 @@ type
protected
{ Protected declarations }
procedure SetShadowColor(Value: TColor);
procedure Paint; override;
property ShadowColor: TColor read FShadowColor write SetShadowColor;
property ShadowColor2: TColor read FShadowColor2 write SetShadowColor2;
@ -91,6 +90,7 @@ type
public
{ Public declarations }
constructor Create(TheOwner: TComponent); override;
procedure Paint; override;
end;
TJLabel = class(TJCustomLabel)

View File

@ -206,12 +206,13 @@ end;
procedure TJLabeledCurrencyEdit.KeyPress(var Key: char);
begin
if (Key in ['.', ',']) then
Key := Decimalseparator;
if (key = DecimalSeparator) and (Pos(key, Text) > 0) then
Key := DefaultFormatSettings.Decimalseparator;
if (key = DefaultFormatSettings.DecimalSeparator) and (Pos(key, Text) > 0) then
key := #0;
if not (Key in ['0'..'9', DecimalSeparator, '+', '-', #8, #9]) then
if not (Key in ['0'..'9', DefaultFormatSettings.DecimalSeparator,
'+', '-', #8, #9]) then
Key := #0;
if (Key = DecimalSeparator) and (fDecimals = 0) then
if (Key = DefaultFormatSettings.DecimalSeparator) and (fDecimals = 0) then
Key := #0;
inherited KeyPress(Key);
end;

View File

@ -314,7 +314,7 @@ constructor TJLabeledDateEdit.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Text := '';
fFormat := ShortDateFormat;
fFormat := DefaultFormatSettings.ShortDateFormat;
theValue := 0;
FButton := TSpeedButton.Create(self);
FButton.Height := Self.Height;

View File

@ -336,7 +336,8 @@ constructor TJLabeledDateTimeEdit.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Text := '';
fFormat := ShortDateFormat + ' ' + ShortTimeFormat;
fFormat := DefaultFormatSettings.ShortDateFormat + ' ' +
DefaultFormatSettings.ShortTimeFormat;
theValue := 0;
formatInput;
FButton := TSpeedButton.Create(self);

View File

@ -216,10 +216,11 @@ end;
procedure TJLabeledFloatEdit.KeyPress(var Key: char);
begin
if (Key in ['.', ',']) then
Key := Decimalseparator;
if (key = DecimalSeparator) and (Pos(key, Text) > 0) then
Key := DefaultFormatSettings.Decimalseparator;
if (key = DefaultFormatSettings.DecimalSeparator) and (Pos(key, Text) > 0) then
key := #0;
if not (Key in ['0'..'9', DecimalSeparator, '+', '-', #8, #9]) then
if not (Key in ['0'..'9', DefaultFormatSettings.DecimalSeparator,
'+', '-', #8, #9]) then
Key := #0;
inherited KeyPress(Key);
end;