diff --git a/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas index f9e6f0267..1c29fe69e 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas @@ -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); diff --git a/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas b/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas index f4709227b..21e8fc80c 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas @@ -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); diff --git a/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas index db2dbbfe4..55b9d43d3 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas @@ -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);