From 36080c86e4bd56cba4e378f34c75ff72342ba477 Mon Sep 17 00:00:00 2001 From: maxim Date: Thu, 9 Jul 2015 22:26:19 +0000 Subject: [PATCH] Merged revision(s) 49301 #41459427dc, 49512 #3768a9fd84 from trunk: LCL: TCustomMaskEdit, do not set selection if control isn't focused. issue #17942 ........ LCL: fixed TMaskEdit left arrow does not move cursor. issue #28385 ........ git-svn-id: branches/fixes_1_4@49515 - --- lcl/maskedit.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lcl/maskedit.pp b/lcl/maskedit.pp index afd0bce296..acde281dea 100644 --- a/lcl/maskedit.pp +++ b/lcl/maskedit.pp @@ -753,7 +753,7 @@ begin begin if FCursorPos < 0 then FCursorPos := 0 else if FCursorPos > FMaskLength then FCursorPos := FMaskLength; - if FCursorPos + 1 > FMaskLength then + if (FCursorPos + 1 > FMaskLength) or not Focused then SetSel(FCursorPos, FCursorPos) else SetSel(FCursorPos, FCursorPos + 1); @@ -777,8 +777,11 @@ end; procedure TCustomMaskEdit.SelectPrevChar; var P: LongInt; + AStart: Integer; + AStop: Integer; begin - if FCursorPos = 0 then Exit; + GetSel(AStart, AStop); + if (FCursorPos = 0) and (AStop - AStart <= 1) then Exit; P := FCursorPos; Dec(FCursorPos); While (FCursorPos > 0) and IsLiteral(FMask[FCursorPos + 1]) do