Sanity checks

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1970 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2011-09-19 11:59:02 +00:00
parent 210a9b2ddd
commit 0f3f32ed94
3 changed files with 46 additions and 23 deletions

View File

@ -135,10 +135,15 @@ end;
procedure TJDBCurrencyEdit.DataChange(Sender: TObject);
begin
if not Focused then
formatInput
if FDataLink.Field <> nil then
begin
if not Focused then
formatInput
else
Caption := FDataLink.Field.AsString;
end
else
Caption := FDataLink.Field.AsString;
Text := '';
end;
function TJDBCurrencyEdit.getDecimals: integer;
@ -157,23 +162,28 @@ procedure TJDBCurrencyEdit.UpdateData(Sender: TObject);
var
theValue: currency;
begin
if IsValidCurrency(Text) then
if FDataLink.Field <> nil then
begin
theValue := StrToCurr(Text);
theValue := ScaleTo(theValue, fDecimales);
Text := CurrToStr(theValue);
FDataLink.Field.Text := Text;
if IsValidCurrency(Text) then
begin
theValue := StrToCurr(Text);
theValue := ScaleTo(theValue, fDecimales);
Text := CurrToStr(theValue);
FDataLink.Field.Text := Text;
end
else
begin
if FDataLink.Field <> nil then
begin
ShowMessage(Caption + ' no es un valor válido');
Caption := FDataLink.Field.AsString;
SelectAll;
SetFocus;
end;
end;
end
else
begin
if FDataLink.Field <> nil then
begin
ShowMessage(Caption + ' no es un valor válido');
Caption := FDataLink.Field.AsString;
SelectAll;
SetFocus;
end;
end;
Text := '';
end;
procedure TJDBCurrencyEdit.FocusRequest(Sender: TObject);

View File

@ -130,10 +130,15 @@ end;
procedure TJDBDateEdit.DataChange(Sender: TObject);
begin
if FDataLink.Field <> nil then
begin
if not Focused then
formatInput
else
Caption := FDataLink.Field.AsString;
end
else
Text := '';
end;
procedure TJDBDateEdit.UpdateData(Sender: TObject);
@ -157,8 +162,9 @@ begin
SelectAll;
SetFocus;
end;
end;
end
else
Text := '';
end;
procedure TJDBDateEdit.FocusRequest(Sender: TObject);

View File

@ -128,10 +128,15 @@ end;
procedure TJDBIntegerEdit.DataChange(Sender: TObject);
begin
if not Focused then
formatInput
if FDataLink.Field <> nil then
begin
if not Focused then
formatInput
else
Caption := FDataLink.Field.AsString;
end
else
Caption := FDataLink.Field.AsString;
Text := '';
end;
@ -148,7 +153,9 @@ begin
SelectAll;
SetFocus;
end;
end;
end
else
Text := '';
end;
procedure TJDBIntegerEdit.FocusRequest(Sender: TObject);