lcl/interfaces/customdrawn/customdrawnwinapi.inc has function TCDWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
function TCDWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
var
LazDC: TLazCanvas absolute DC;
begin
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[DrawFocusRect] DC: %x', [PtrUInt(DC)]));
{$endif}
Result := False;
if not IsValidDC(DC) then exit;
// Drawer.DrawFocusRect alters the Pen and Brush, so we save the state here
LazDC.SaveState();
GetDefaultDrawer().DrawFocusRect(LazDC, Types.Point(Rect.Left, Rect.Top),
Types.Size(Rect.Right - Rect.Left, Rect.Bottom - Rect.Top));
LazDC.RestoreState(-1);
end;
As can be seen, the function always returns false. If IsValidDC(DC) is true then GetDefaultDrawer().DrawFocusRect is called, which means the function should return true.
The following patch fixes that.
diff --git a/lcl/interfaces/customdrawn/customdrawnwinapi.inc b/lcl/interfaces/customdrawn/customdrawnwinapi.inc
index d64c094dc0..57e37a563b 100644
--- a/lcl/interfaces/customdrawn/customdrawnwinapi.inc
+++ b/lcl/interfaces/customdrawn/customdrawnwinapi.inc
@@ -1086,6 +1086,7 @@ begin
GetDefaultDrawer().DrawFocusRect(LazDC, Types.Point(Rect.Left, Rect.Top),
Types.Size(Rect.Right - Rect.Left, Rect.Bottom - Rect.Top));
LazDC.RestoreState(-1);
+ Result := True;
end;
function TCDWidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; uType,