diff --git a/components/jujiboutils/src/jdbgridcontrol.pas b/components/jujiboutils/src/jdbgridcontrol.pas index 78e8b4495..d4a080c66 100644 --- a/components/jujiboutils/src/jdbgridcontrol.pas +++ b/components/jujiboutils/src/jdbgridcontrol.pas @@ -78,6 +78,8 @@ type property Columns: TJDBGridColumns read GetColumns write SetColumns; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); override; + function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): boolean; override; + function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): boolean; override; procedure KeyDown(var Key: word; Shift: TShiftState); override; public { Public declarations } @@ -203,13 +205,35 @@ end; procedure TJDBGridControl.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: integer); +begin + if (Button = mbLeft) and not (integerDbGridControl.CanDefocus and + doubleDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and + stringDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and + timeDbGridControl.CanDefocus) then + abort + else + inherited MouseDown(Button, Shift, X, Y); +end; + +function TJDBGridControl.DoMouseWheelDown(Shift: TShiftState; + MousePos: TPoint): boolean; begin if not (integerDbGridControl.CanDefocus and doubleDbGridControl.CanDefocus and dateTimeDbGridControl.CanDefocus and stringDbGridControl.CanDefocus and dateDbGridControl.CanDefocus and timeDbGridControl.CanDefocus) then abort else - inherited MouseDown(Button, Shift, X, Y); + Result := inherited DoMouseWheelDown(Shift, MousePos); +end; + +function TJDBGridControl.DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): boolean; +begin + if not (integerDbGridControl.CanDefocus and doubleDbGridControl.CanDefocus and + dateTimeDbGridControl.CanDefocus and stringDbGridControl.CanDefocus and + dateDbGridControl.CanDefocus and timeDbGridControl.CanDefocus) then + abort + else + Result := inherited DoMouseWheelUp(Shift, MousePos); end; procedure TJDBGridControl.KeyDown(var Key: word; Shift: TShiftState); diff --git a/components/jujiboutils/src/jdbgridutils.pas b/components/jujiboutils/src/jdbgridutils.pas index 8c5c2cf0e..ca51d27e8 100644 --- a/components/jujiboutils/src/jdbgridutils.pas +++ b/components/jujiboutils/src/jdbgridutils.pas @@ -293,6 +293,7 @@ end; function TJDbGridStringCtrl.CanDefocus: boolean; begin Result := True; + myEditOnEditingDone(nil); end; { TJDbGridDateTimeCtrl } @@ -530,7 +531,9 @@ begin begin ShowMessage(Format(SInvalidDateTime, [CellEditor.Text])); CellEditor.Text := EditText; - end; + end + else + myEditOnEditingDone(nil); end; { TJDbGridTimeCtrl } @@ -720,7 +723,9 @@ begin begin ShowMessage(Format(SInvalidTime, [CellEditor.Text])); CellEditor.Text := Field.AsString; - end; + end + else + myEditOnEditingDone(nil); end; { TJDbGridDateCtrl } @@ -949,7 +954,9 @@ begin begin ShowMessage(Format(SInvalidDate, [CellEditor.Text])); CellEditor.Text := Field.AsString; - end; + end + else + myEditOnEditingDone(nil); end; { TJDbGridDoubleCtrl } @@ -1120,10 +1127,12 @@ begin begin ShowMessage(Format(SInvalidNumber, [CellEditor.Text])); if Length(fEFormat) > 0 then - CellEditor.Text := FormatFloat(fEFormat, Field.AsFloat) + CellEditor.Text := FormatFloat(fEFormat, Field.AsFloat) + else + CellEditor.Text := Field.AsString; + end else - CellEditor.Text := Field.AsString; - end; + myEditOnEditingDone(nil); end; { TJDbGridIntegerCtrl } @@ -1255,7 +1264,9 @@ begin begin ShowMessage(Format(SInvalidNumber, [CellEditor.Text])); CellEditor.Text := Field.AsString; - end; + end + else + myEditOnEditingDone(nil); end; end.