You've already forked lazarus-ccr
Manage MouseWheel events
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3062 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -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);
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user