You've already forked lazarus-ccr
Be sure Field and Dataset are assigned and active
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2696 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -185,6 +185,8 @@ uses
|
|||||||
procedure TJDbGridStringCtrl.myEditEnter(Sender: TObject);
|
procedure TJDbGridStringCtrl.myEditEnter(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Field := theGrid.SelectedField;
|
Field := theGrid.SelectedField;
|
||||||
|
if not Assigned(Field) then
|
||||||
|
abort;
|
||||||
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
||||||
@ -196,6 +198,8 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridStringCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridStringCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
if (not updated) then
|
if (not updated) then
|
||||||
begin
|
begin
|
||||||
if CellEditor.Text <> Field.AsString then
|
if CellEditor.Text <> Field.AsString then
|
||||||
@ -276,6 +280,8 @@ end;
|
|||||||
procedure TJDbGridDateTimeCtrl.myEditEnter(Sender: TObject);
|
procedure TJDbGridDateTimeCtrl.myEditEnter(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Field := theGrid.SelectedField;
|
Field := theGrid.SelectedField;
|
||||||
|
if not Assigned(Field) then
|
||||||
|
abort;
|
||||||
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
||||||
@ -287,6 +293,10 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridDateTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridDateTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
if Length(CellEditor.Caption) = 0 then
|
if Length(CellEditor.Caption) = 0 then
|
||||||
begin
|
begin
|
||||||
if Field.Value <> Null then
|
if Field.Value <> Null then
|
||||||
@ -310,7 +320,7 @@ begin
|
|||||||
if FormatDateTime(DisplayFormat, theValue) <>
|
if FormatDateTime(DisplayFormat, theValue) <>
|
||||||
FormatDateTime(DisplayFormat, Field.AsDateTime) then
|
FormatDateTime(DisplayFormat, Field.AsDateTime) then
|
||||||
begin
|
begin
|
||||||
Field.DataSet.DisableControls;
|
// Field.DataSet.DisableControls;
|
||||||
Field.DataSet.Edit;
|
Field.DataSet.Edit;
|
||||||
Field.AsDateTime := theValue;
|
Field.AsDateTime := theValue;
|
||||||
Field.DataSet.EnableControls;
|
Field.DataSet.EnableControls;
|
||||||
@ -461,6 +471,8 @@ end;
|
|||||||
procedure TJDbGridTimeCtrl.myEditEnter(Sender: TObject);
|
procedure TJDbGridTimeCtrl.myEditEnter(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Field := theGrid.SelectedField;
|
Field := theGrid.SelectedField;
|
||||||
|
if not Assigned(Field) then
|
||||||
|
abort;
|
||||||
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
||||||
@ -472,6 +484,8 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridTimeCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
if Length(CellEditor.Caption) = 0 then
|
if Length(CellEditor.Caption) = 0 then
|
||||||
begin
|
begin
|
||||||
if Field.Value <> Null then
|
if Field.Value <> Null then
|
||||||
@ -645,6 +659,8 @@ end;
|
|||||||
procedure TJDbGridDateCtrl.myEditEnter(Sender: TObject);
|
procedure TJDbGridDateCtrl.myEditEnter(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Field := theGrid.SelectedField;
|
Field := theGrid.SelectedField;
|
||||||
|
if not Assigned(Field) then
|
||||||
|
abort;
|
||||||
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
||||||
@ -656,6 +672,8 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridDateCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridDateCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
if Length(CellEditor.Caption) = 0 then
|
if Length(CellEditor.Caption) = 0 then
|
||||||
begin
|
begin
|
||||||
if Field.Value <> Null then
|
if Field.Value <> Null then
|
||||||
@ -830,6 +848,8 @@ end;
|
|||||||
procedure TJDbGridDoubleCtrl.myEditOnEnter(Sender: TObject);
|
procedure TJDbGridDoubleCtrl.myEditOnEnter(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Field := theGrid.SelectedField;
|
Field := theGrid.SelectedField;
|
||||||
|
if not Assigned(Field) then
|
||||||
|
Abort;
|
||||||
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
CellEditor.BoundsRect := theGrid.SelectedFieldRect;
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
|
||||||
@ -841,6 +861,8 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridDoubleCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridDoubleCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
if IsValidFloat(CellEditor.Caption) then
|
if IsValidFloat(CellEditor.Caption) then
|
||||||
begin
|
begin
|
||||||
if (not updated) then
|
if (not updated) then
|
||||||
@ -1033,6 +1055,8 @@ end;
|
|||||||
|
|
||||||
procedure TJDbGridIntegerCtrl.myEditOnEditingDone(Sender: TObject);
|
procedure TJDbGridIntegerCtrl.myEditOnEditingDone(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if not Assigned(Field) or not Assigned(Field.Dataset) or not Field.DataSet.Active then
|
||||||
|
exit;
|
||||||
if IsValidInteger(CellEditor.Caption) then
|
if IsValidInteger(CellEditor.Caption) then
|
||||||
begin
|
begin
|
||||||
if (not updated) then
|
if (not updated) then
|
||||||
|
Reference in New Issue
Block a user