From 4f5ad5142a42908631df514ca714d847304ad896 Mon Sep 17 00:00:00 2001 From: dmitry Date: Tue, 25 Jun 2019 13:00:19 +0000 Subject: [PATCH] cocoa: preventing memo from getting focus while in design mode git-svn-id: trunk@61474 - --- lcl/interfaces/cocoa/cocoatextedits.pas | 10 +++++++++- lcl/interfaces/cocoa/cocoawsstdctrls.pas | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/cocoa/cocoatextedits.pas b/lcl/interfaces/cocoa/cocoatextedits.pas index a7cae6fe5e..99dd74e482 100644 --- a/lcl/interfaces/cocoa/cocoatextedits.pas +++ b/lcl/interfaces/cocoa/cocoatextedits.pas @@ -109,8 +109,11 @@ type keyCaptured: Boolean; wantReturns: Boolean; + preventInput: Boolean; + procedure dealloc; override; function acceptsFirstResponder: LCLObjCBoolean; override; + function canBecomeKeyView: Boolean; override; function undoManager: NSUndoManager; override; function lclGetCallback: ICommonCallback; override; procedure lclClearCallback; override; @@ -995,7 +998,12 @@ end; function TCocoaTextView.acceptsFirstResponder: LCLObjCBoolean; begin - Result := True; + Result := not preventInput; +end; + +function TCocoaTextView.canBecomeKeyView: Boolean; +begin + Result := not preventInput; end; function TCocoaTextView.undoManager: NSUndoManager; diff --git a/lcl/interfaces/cocoa/cocoawsstdctrls.pas b/lcl/interfaces/cocoa/cocoawsstdctrls.pas index 7dbf396a18..d2b1b1daf5 100644 --- a/lcl/interfaces/cocoa/cocoawsstdctrls.pas +++ b/lcl/interfaces/cocoa/cocoawsstdctrls.pas @@ -1444,6 +1444,7 @@ begin TextViewSetAllignment(txt, TCustomMemo(AWinControl).Alignment); txt.wantReturns := TCustomMemo(AWinControl).WantReturns; txt.callback.SetTabSuppress(not TCustomMemo(AWinControl).WantTabs); + txt.preventInput := csDesigning in TCustomMemo(AWinControl).ComponentState; Result := TLCLIntfHandle(scr); end;