diff --git a/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi b/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi index dfd5e14e8..c797158c2 100644 --- a/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi +++ b/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi @@ -22,6 +22,9 @@ + + + @@ -37,12 +40,12 @@ - + - + @@ -54,22 +57,22 @@ - + - + - - - - + + + + @@ -78,20 +81,20 @@ - + - + - + @@ -103,7 +106,7 @@ - + @@ -112,9 +115,9 @@ - - - + + + @@ -122,24 +125,24 @@ - + - + - + - + - + @@ -148,139 +151,221 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + - + - + - + - - + - + - + - + - + - + - + diff --git a/components/nicegrid/source/nicegrid.pas b/components/nicegrid/source/nicegrid.pas index 93460be54..d6acc90cb 100644 --- a/components/nicegrid/source/nicegrid.pas +++ b/components/nicegrid/source/nicegrid.pas @@ -287,8 +287,8 @@ type procedure WMMouseWheel(var Msg: TLMessage{TWMMouseWheel}); message LM_MOUSEWHEEL; procedure WMSize(var Msg: TLMessage); message LM_SIZE; procedure WMEraseBkgnd(var Msg: TLMEraseBkGnd); message LM_ERASEBKGND; - procedure WMSetFocus(var Msg: TLMSetFocus); message LM_SETFOCUS; - procedure WMKillFocus(var Msg: TLMKillFocus); message LM_KILLFOCUS; +// procedure WMSetFocus(var Msg: TLMSetFocus); message LM_SETFOCUS; +// procedure WMKillFocus(var Msg: TLMKillFocus); message LM_KILLFOCUS; procedure CMWantSpecialKey(var Message: TLMKey); message CM_WANTSPECIALKEY; procedure CMFontChanged(var Msg: TLMessage); message CM_FONTCHANGED; {$ELSE} @@ -409,6 +409,8 @@ type function TextExtent(const s: String): TSize; {$IFDEF FPC} procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double); override; + procedure DoEnter; override; + procedure DoExit; override; {$ENDIF} public @@ -1967,7 +1969,6 @@ var end; begin - if not FEnabled then Exit; @@ -2175,7 +2176,7 @@ begin begin IsEditing := True; FEdit.ShowEdit(FCol, FRow); - FEdit.SelectAll; + FEdit.SetFocus; end; //end; end; @@ -2287,7 +2288,6 @@ begin UpdateColRow; end; end; - end; end; @@ -3161,12 +3161,18 @@ begin CaretVisible := True; end; -procedure TNiceGrid.WMKillFocus(var Msg: {$IFDEF FPC}TLMKillFocus{$ELSE}TWMKillFocus{$ENDIF}); +{$IFDEF FPC} +procedure TNiceGrid.DoExit; +{$ELSE} +procedure TNiceGrid.WMKillFocus(var Msg: TWMKillFocus); +{$ENDIF} begin if FEdit.HandleAllocated then begin - if (Msg.FocusedWnd <> FEdit.Handle) - then ForceHideCaret; + {$IFNDEF FPC} + if (Msg.FocusedWnd <> FEdit.Handle) then + {$ENDIF} + ForceHideCaret; DestroyCaret{$IFDEF FPC}(FEdit.Handle){$ENDIF}; end; CaretVisible := False; @@ -3174,9 +3180,12 @@ begin then InvalidateCells; end; -procedure TNiceGrid.WMSetFocus(var Msg: {$IFDEF FPC}TLMSetFocus{$ELSE}TWMSetFocus{$ENDIF}); +{$IFDEF FPC} +procedure TNiceGrid.DoEnter; +{$ELSE} +procedure TNiceGrid.WMSetFocus(var Msg: TWMSetFocus); +{$ENDIF} begin - Unused(Msg); CreateCaret(Handle, 0, 1, FDefRowHeight - 2); CaretVisible := False; InvalidateCells; @@ -4110,6 +4119,7 @@ begin SetBounds(l, t, w, h); Show; + SetFocus; end;