View Issue Details

IDProjectCategoryView StatusLast Update
0015358LazarusWidgetsetpublic2009-12-22 11:06
ReporterLuiz Americo Assigned ToPaul Ishenin  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindows 
Product Version0.9.29 (SVN) 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0015358: DrawFrameControl does not draw correctly flat buttons under Win32
DescriptionLCLIntf.DrawFrameControl does not call directly Windows.DrawFrameControl for flat buttons.

This lead to problems when trying to draw flat buttons.

See attached pictures and attached demo (uncomment NativeDrawFrameControl define to see the win32 expected result).

The attached patch removes the changes calling directly the windows function.

I tried some controls with Flat property (TToolButton, TSpeedButton) to see how this change affect them but those are not using that function.
TagsNo tags attached.
Fixed in Revision23230
LazTarget0.9.30
WidgetsetWin32/Win64
Attached Files

Activities

2009-12-16 19:52

 

drawframecontrol.diff (1,190 bytes)   
Index: lcl/interfaces/win32/win32winapi.inc
===================================================================
--- lcl/interfaces/win32/win32winapi.inc	(revision 23148)
+++ lcl/interfaces/win32/win32winapi.inc	(working copy)
@@ -1178,21 +1178,8 @@
   Draws a frame control of the specified type and style.
  ------------------------------------------------------------------------------}
 function TWin32WidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; UType, UState: Cardinal): Boolean;
-var
-  Flags: dword;
 begin
-  // flat button border cannot be drawn by DrawFrameControl, draw ourselves
-  if (UType = DFC_BUTTON) and ((UState and DFCS_FLAT) <> 0) then
-  begin
-    if (UState and DFCS_PUSHED) <> 0 then
-      Flags := BDR_SUNKENOUTER
-    else
-      if (UState and DFCS_FLAT) <> 0 then Flags := 0
-      else Flags := BDR_RAISEDINNER;
-    Result := Boolean(Windows.DrawEdge(DC, @Rect, Flags, BF_RECT));
-  end else begin
-    Result := Boolean(Windows.DrawFrameControl(DC, @Rect, UType, UState));
-  end;
+  Result := Boolean(Windows.DrawFrameControl(DC, @Rect, UType, UState));
 end;
 
 function TWin32WidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
drawframecontrol.diff (1,190 bytes)   

2009-12-16 19:52

 

win32_lcl.bmp (43,254 bytes)   
win32_lcl.bmp (43,254 bytes)   

2009-12-16 19:53

 

win32_native.bmp (43,254 bytes)   
win32_native.bmp (43,254 bytes)   

2009-12-16 19:53

 

DrawFrameControl2.zip (2,558 bytes)

Paul Ishenin

2009-12-22 08:04

manager   ~0033250

Thanks, applied. I double checked that code is nowhere used now. Please close.

Issue History

Date Modified Username Field Change
2009-12-16 19:52 Luiz Americo New Issue
2009-12-16 19:52 Luiz Americo File Added: drawframecontrol.diff
2009-12-16 19:52 Luiz Americo Widgetset => Win32/Win64
2009-12-16 19:52 Luiz Americo File Added: win32_lcl.bmp
2009-12-16 19:53 Luiz Americo File Added: win32_native.bmp
2009-12-16 19:53 Luiz Americo File Added: DrawFrameControl2.zip
2009-12-17 14:30 Vincent Snijders LazTarget => 0.9.30
2009-12-17 14:30 Vincent Snijders Status new => acknowledged
2009-12-17 14:30 Vincent Snijders Target Version => 0.9.30
2009-12-22 08:04 Paul Ishenin Fixed in Revision => 23230
2009-12-22 08:04 Paul Ishenin Status acknowledged => resolved
2009-12-22 08:04 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-12-22 08:04 Paul Ishenin Resolution open => fixed
2009-12-22 08:04 Paul Ishenin Assigned To => Paul Ishenin
2009-12-22 08:04 Paul Ishenin Note Added: 0033250
2009-12-22 11:06 Luiz Americo Status resolved => closed