Explorar o código

Bug 1791: Edited path was hidden behind a browsing button on file/directory path selection boxes

https://winscp.net/tracker/1791

Caused by db716004

Source commit: 96935c29274d1bb02294bd513892dd40b7d6d3a7
Martin Prikryl %!s(int64=6) %!d(string=hai) anos
pai
achega
3ad38b5bd9
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  1. 6 4
      source/packages/my/ComboEdit.pas

+ 6 - 4
source/packages/my/ComboEdit.pas

@@ -478,10 +478,10 @@ end;
 
 procedure TCustomComboEdit.SetEditRect;
 var
-  Loc: TRect;
+  RMargin: Integer;
 begin
-  SetRect(Loc, 0, 0, ClientWidth - FBtnControl.Width - 2, ClientHeight + 1);
-  SendMessage(Handle, EM_SETRECTNP, 0, LongInt(@Loc));
+  RMargin := FBtnControl.Width + ScaleByTextHeight(Self, 2);
+  SendMessage(Handle, EM_SETMARGINS, EC_RIGHTMARGIN, MakeLong(0, RMargin));
 end;
 
 procedure TCustomComboEdit.UpdateBtnBounds;
@@ -564,7 +564,9 @@ end;
 procedure TCustomComboEdit.CMFontChanged(var Message: TMessage);
 begin
   inherited;
-  if HandleAllocated then SetEditRect;
+  // Among other, this counters the EM_SETMARGINS call in TCustomEdit.WMSetFont.
+  // Equivalent to TCustomButtonedEdit.WndProc.
+  if HandleAllocated then UpdateBtnBounds;
 end;
 
 procedure TCustomComboEdit.CMEnabledChanged(var Message: TMessage);