Forum > CustomDrawn
[SOLVED] TCDWidgetSet.DrawFocusRect always returns false
(1/1)
lagprogramming:
lcl/interfaces/customdrawn/customdrawnwinapi.inc has function TCDWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---diff --git a/lcl/interfaces/customdrawn/customdrawnwinapi.inc b/lcl/interfaces/customdrawn/customdrawnwinapi.incindex 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,
wp:
Applied, thank you.
Navigation
[0] Message Index