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;
|
||||
X, Y: integer);
|
||||
begin
|
||||
if (Button = mbLeft) and not (integerDbGridControl.CanDefocus and
|
||||
if not (integerDbGridControl.CanDefocus and
|
||||
doubleDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and
|
||||
stringDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and
|
||||
timeDbGridControl.CanDefocus) then
|
||||
|
@ -233,6 +233,7 @@ begin
|
||||
Field.DataSet.Edit;
|
||||
Field.AsString := CellEditor.Text;
|
||||
field.DataSet.EnableControls;
|
||||
updated := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -293,7 +294,11 @@ end;
|
||||
function TJDbGridStringCtrl.CanDefocus: boolean;
|
||||
begin
|
||||
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;
|
||||
|
||||
{ TJDbGridDateTimeCtrl }
|
||||
@ -361,6 +366,7 @@ begin
|
||||
Field.DataSet.Edit;
|
||||
Field.AsDateTime := theValue;
|
||||
Field.DataSet.EnableControls;
|
||||
updated := True;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
@ -531,8 +537,9 @@ begin
|
||||
begin
|
||||
ShowMessage(Format(SInvalidDateTime, [CellEditor.Text]));
|
||||
CellEditor.Text := EditText;
|
||||
end
|
||||
else
|
||||
end;
|
||||
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||
(Field.DataSet.State in dsEditModes) then
|
||||
myEditOnEditingDone(nil);
|
||||
end;
|
||||
|
||||
@ -592,6 +599,7 @@ begin
|
||||
Field.DataSet.Edit;
|
||||
Field.Text := NormalizeTime(CellEditor.Caption, Field.AsDateTime);
|
||||
Field.DataSet.EnableControls;
|
||||
updated := True;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
@ -723,8 +731,9 @@ begin
|
||||
begin
|
||||
ShowMessage(Format(SInvalidTime, [CellEditor.Text]));
|
||||
CellEditor.Text := Field.AsString;
|
||||
end
|
||||
else
|
||||
end;
|
||||
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||
(Field.DataSet.State in dsEditModes) then
|
||||
myEditOnEditingDone(nil);
|
||||
end;
|
||||
|
||||
@ -784,6 +793,7 @@ begin
|
||||
Field.DataSet.Edit;
|
||||
Field.AsDateTime := theValue;
|
||||
field.DataSet.EnableControls;
|
||||
updated := True;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
@ -954,8 +964,9 @@ begin
|
||||
begin
|
||||
ShowMessage(Format(SInvalidDate, [CellEditor.Text]));
|
||||
CellEditor.Text := Field.AsString;
|
||||
end
|
||||
else
|
||||
end;
|
||||
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||
(Field.DataSet.State in dsEditModes) then
|
||||
myEditOnEditingDone(nil);
|
||||
end;
|
||||
|
||||
@ -1004,6 +1015,7 @@ begin
|
||||
theValue := ScaleTo(theValue, fDecimals);
|
||||
Field.Value := theValue;
|
||||
Field.DataSet.EnableControls;
|
||||
updated := True;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
@ -1130,8 +1142,9 @@ begin
|
||||
CellEditor.Text := FormatFloat(fEFormat, Field.AsFloat)
|
||||
else
|
||||
CellEditor.Text := Field.AsString;
|
||||
end
|
||||
else
|
||||
end;
|
||||
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||
(Field.DataSet.State in dsEditModes) then
|
||||
myEditOnEditingDone(nil);
|
||||
end;
|
||||
|
||||
@ -1264,8 +1277,9 @@ begin
|
||||
begin
|
||||
ShowMessage(Format(SInvalidNumber, [CellEditor.Text]));
|
||||
CellEditor.Text := Field.AsString;
|
||||
end
|
||||
else
|
||||
end;
|
||||
if Result and Assigned(Field) and Assigned(Field.Dataset) and
|
||||
(Field.DataSet.State in dsEditModes) then
|
||||
myEditOnEditingDone(nil);
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user