diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas index e633571903..e3174ccef6 100644 --- a/lcl/dbgrids.pas +++ b/lcl/dbgrids.pas @@ -2535,7 +2535,7 @@ var P: TPoint; procedure doMouseDown; begin - if not Focused then + if not Focused and not(csNoFocus in ControlStyle) then SetFocus; if assigned(OnMouseDown) then OnMouseDown(Self, Button, Shift, X, Y); diff --git a/lcl/grids.pas b/lcl/grids.pas index 7d9e793d4c..d78bfb9a99 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -6091,7 +6091,7 @@ procedure TCustomGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, function DoAutoEdit: boolean; begin - result := FAutoEdit and EditingAllowed(FCol) and + result := FAutoEdit and not(csNoFocus in ControlStyle) and EditingAllowed(FCol) and (FGCache.ClickCell.X=Col) and (FGCache.ClickCell.Y=Row); if result then begin SelectEditor; @@ -6113,7 +6113,7 @@ begin DebugLn('Mouse was in ', dbgs(FGCache.HotGridZone)); {$ENDIF} - if not Focused then begin + if not Focused and not(csNoFocus in ControlStyle) then begin SetFocus; if not Focused then begin {$ifDef dbgGrid} DebugLnExit('TCustomGrid.MouseDown EXIT: Focus not allowed'); {$Endif}