You've already forked lazarus-ccr
Fix: Editing while mouse events
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3071 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -205,7 +205,7 @@ end;
|
|||||||
procedure TJDBGridControl.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure TJDBGridControl.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: integer);
|
X, Y: integer);
|
||||||
begin
|
begin
|
||||||
if (Button = mbLeft) and not (integerDbGridControl.CanDefocus and
|
if not (integerDbGridControl.CanDefocus and
|
||||||
doubleDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and
|
doubleDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and
|
||||||
stringDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and
|
stringDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and
|
||||||
timeDbGridControl.CanDefocus) then
|
timeDbGridControl.CanDefocus) then
|
||||||
|
@ -233,6 +233,7 @@ begin
|
|||||||
Field.DataSet.Edit;
|
Field.DataSet.Edit;
|
||||||
Field.AsString := CellEditor.Text;
|
Field.AsString := CellEditor.Text;
|
||||||
field.DataSet.EnableControls;
|
field.DataSet.EnableControls;
|
||||||
|
updated := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -293,7 +294,11 @@ end;
|
|||||||
function TJDbGridStringCtrl.CanDefocus: boolean;
|
function TJDbGridStringCtrl.CanDefocus: boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
myEditOnEditingDone(nil);
|
if not CellEditor.Focused then
|
||||||
|
exit;
|
||||||
|
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||||
|
(Field.DataSet.State in dsEditModes) then
|
||||||
|
myEditOnEditingDone(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TJDbGridDateTimeCtrl }
|
{ TJDbGridDateTimeCtrl }
|
||||||
@ -361,6 +366,7 @@ begin
|
|||||||
Field.DataSet.Edit;
|
Field.DataSet.Edit;
|
||||||
Field.AsDateTime := theValue;
|
Field.AsDateTime := theValue;
|
||||||
Field.DataSet.EnableControls;
|
Field.DataSet.EnableControls;
|
||||||
|
updated := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -531,8 +537,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowMessage(Format(SInvalidDateTime, [CellEditor.Text]));
|
ShowMessage(Format(SInvalidDateTime, [CellEditor.Text]));
|
||||||
CellEditor.Text := EditText;
|
CellEditor.Text := EditText;
|
||||||
end
|
end;
|
||||||
else
|
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||||
|
(Field.DataSet.State in dsEditModes) then
|
||||||
myEditOnEditingDone(nil);
|
myEditOnEditingDone(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -592,6 +599,7 @@ begin
|
|||||||
Field.DataSet.Edit;
|
Field.DataSet.Edit;
|
||||||
Field.Text := NormalizeTime(CellEditor.Caption, Field.AsDateTime);
|
Field.Text := NormalizeTime(CellEditor.Caption, Field.AsDateTime);
|
||||||
Field.DataSet.EnableControls;
|
Field.DataSet.EnableControls;
|
||||||
|
updated := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -723,8 +731,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowMessage(Format(SInvalidTime, [CellEditor.Text]));
|
ShowMessage(Format(SInvalidTime, [CellEditor.Text]));
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
end
|
end;
|
||||||
else
|
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||||
|
(Field.DataSet.State in dsEditModes) then
|
||||||
myEditOnEditingDone(nil);
|
myEditOnEditingDone(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -784,6 +793,7 @@ begin
|
|||||||
Field.DataSet.Edit;
|
Field.DataSet.Edit;
|
||||||
Field.AsDateTime := theValue;
|
Field.AsDateTime := theValue;
|
||||||
field.DataSet.EnableControls;
|
field.DataSet.EnableControls;
|
||||||
|
updated := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -954,8 +964,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowMessage(Format(SInvalidDate, [CellEditor.Text]));
|
ShowMessage(Format(SInvalidDate, [CellEditor.Text]));
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
end
|
end;
|
||||||
else
|
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||||
|
(Field.DataSet.State in dsEditModes) then
|
||||||
myEditOnEditingDone(nil);
|
myEditOnEditingDone(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1004,6 +1015,7 @@ begin
|
|||||||
theValue := ScaleTo(theValue, fDecimals);
|
theValue := ScaleTo(theValue, fDecimals);
|
||||||
Field.Value := theValue;
|
Field.Value := theValue;
|
||||||
Field.DataSet.EnableControls;
|
Field.DataSet.EnableControls;
|
||||||
|
updated := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -1130,8 +1142,9 @@ begin
|
|||||||
CellEditor.Text := FormatFloat(fEFormat, Field.AsFloat)
|
CellEditor.Text := FormatFloat(fEFormat, Field.AsFloat)
|
||||||
else
|
else
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
end
|
end;
|
||||||
else
|
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||||
|
(Field.DataSet.State in dsEditModes) then
|
||||||
myEditOnEditingDone(nil);
|
myEditOnEditingDone(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1264,8 +1277,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowMessage(Format(SInvalidNumber, [CellEditor.Text]));
|
ShowMessage(Format(SInvalidNumber, [CellEditor.Text]));
|
||||||
CellEditor.Text := Field.AsString;
|
CellEditor.Text := Field.AsString;
|
||||||
end
|
end;
|
||||||
else
|
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||||
|
(Field.DataSet.State in dsEditModes) then
|
||||||
myEditOnEditingDone(nil);
|
myEditOnEditingDone(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user