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]; ms := tokens[1];
if (tokens.Count > 2) and (tokens[2] <> '') then if (tokens.Count > 2) and (tokens[2] <> '') then
ys := tokens[2]; ys := tokens[2];
texto := ds + DateSeparator + ms + DateSeparator + ys; texto := ds + DefaultFormatSettings.DateSeparator + ms +
DefaultFormatSettings.DateSeparator + ys;
end; end;
procedure MiddleEndianForm; procedure MiddleEndianForm;
@ -88,7 +89,8 @@ var
ds := tokens[1]; ds := tokens[1];
if (tokens.Count > 2) and (tokens[2] <> '') then if (tokens.Count > 2) and (tokens[2] <> '') then
ys := tokens[2]; ys := tokens[2];
texto := ms + DateSeparator + ds + DateSeparator + ys; texto := ms + DefaultFormatSettings.DateSeparator + ds +
DefaultFormatSettings.DateSeparator + ys;
end; end;
procedure BigEndianForm; procedure BigEndianForm;
@ -99,12 +101,13 @@ var
ms := tokens[1]; ms := tokens[1];
if (tokens.Count > 2) and (tokens[2] <> '') then if (tokens.Count > 2) and (tokens[2] <> '') then
ds := tokens[2]; ds := tokens[2];
texto := ys + DateSeparator + ms + DateSeparator + ds; texto := ys + DefaultFormatSettings.DateSeparator + ms +
DefaultFormatSettings.DateSeparator + ds;
end; end;
begin begin
if theFormat = '' then if theFormat = '' then
aDateFormat := ShortDateFormat aDateFormat := DefaultFormatSettings.ShortDateFormat
else else
aDateFormat := theFormat; aDateFormat := theFormat;
if theValue = 0 then if theValue = 0 then
@ -118,7 +121,7 @@ begin
texto := NormalizeDateSeparator(texto); texto := NormalizeDateSeparator(texto);
Result := texto; // default value Result := texto; // default value
tokens := TStringList.Create; tokens := TStringList.Create;
Split(DateSeparator, texto, tokens); Split(DefaultFormatSettings.DateSeparator, texto, tokens);
if tokens.Count > 0 then if tokens.Count > 0 then
begin begin
aChar := aDateFormat[1]; aChar := aDateFormat[1];
@ -149,7 +152,8 @@ var
function TimeString: string; function TimeString: string;
begin begin
Result := hhs + TimeSeparator + mms + TimeSeparator + sss;// + TimeSeparator + mss; Result := hhs + DefaultFormatSettings.TimeSeparator + mms +
DefaultFormatSettings.TimeSeparator + sss;// + TimeSeparator + mss;
end; end;
procedure TimeForm; procedure TimeForm;
@ -167,7 +171,7 @@ var
begin begin
if theFormat = '' then if theFormat = '' then
aTimeFormat := ShortTimeFormat aTimeFormat := DefaultFormatSettings.ShortTimeFormat
else else
aTimeFormat := theFormat; aTimeFormat := theFormat;
if theValue = 0 then if theValue = 0 then
@ -186,7 +190,7 @@ begin
texto := Value; texto := Value;
Result := texto; // default value Result := texto; // default value
tokens := TStringList.Create; tokens := TStringList.Create;
Split(TimeSeparator, texto, tokens); Split(DefaultFormatSettings.TimeSeparator, texto, tokens);
if tokens.Count > 0 then if tokens.Count > 0 then
begin begin
TimeForm; TimeForm;
@ -194,7 +198,7 @@ begin
begin begin
aTime := StrToTime(texto); aTime := StrToTime(texto);
Result := TimeString;// FormatDateTime(aTimeFormat, aTime); Result := TimeString;// FormatDateTime(aTimeFormat, aTime);
end end;
end; end;
tokens.Free; tokens.Free;
//ShowMessage('Hora normalizada: ' + Result); //ShowMessage('Hora normalizada: ' + Result);
@ -235,7 +239,7 @@ begin
Result := s; Result := s;
for i := 1 to length(Result) do for i := 1 to length(Result) do
if Result[i] in ['.', ',', '/', '-'] then // valid date separators if Result[i] in ['.', ',', '/', '-'] then // valid date separators
Result[i] := DateSeparator; Result[i] := DefaultFormatSettings.DateSeparator;
end; end;
function IsValidDateString(const Value: string): boolean; 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 + #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' + #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 + '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. end.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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