View Issue Details

IDProjectCategoryView StatusLast Update
0016140LazarusLCLpublic2016-12-20 20:07
ReporterChristianAssigned ToMichl 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version0.9.28.3 (SVN)Product Buildr53722, r53739 
Target Version1.6.4Fixed in Version1.7 (SVN) 
Summary0016140: TMemo Text Flickers wild on Sizing
Description(not depend on new Autosize)
TagsNo tags attached.
Fixed in Revisionr53722
LazTarget1.6.4
WidgetsetWin32/Win64
Attached Files
  • MemoTest.zip (3,305 bytes)
  • win32wsstdctrls.pp.patch (1,215 bytes)
    Index: lcl/interfaces/win32/win32wsstdctrls.pp
    ===================================================================
    --- lcl/interfaces/win32/win32wsstdctrls.pp	(revision 53363)
    +++ lcl/interfaces/win32/win32wsstdctrls.pp	(working copy)
    @@ -1336,6 +1336,28 @@
     
     { TWin32WSCustomMemo }
     
    +function MemoWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
    +    LParam: Windows.LParam): LResult; stdcall;
    +var
    +  Control: TWinControl;
    +  LMessage: TLMessage;
    +begin
    +  case Msg of
    +    // prevent flickering, Mantis #0016140
    +    WM_ERASEBKGND:
    +      begin
    +        Control := GetWin32WindowInfo(Window)^.WinControl;
    +        LMessage.msg := Msg;
    +        LMessage.wParam := WParam;
    +        LMessage.lParam := LParam;
    +        LMessage.Result := 0;
    +        Result := DeliverMessage(Control, LMessage);
    +      end;
    +    else
    +      Result := WindowProc(Window, Msg, WParam, LParam);
    +  end;
    +end;
    +
     class function TWin32WSCustomMemo.CreateHandle(const AWinControl: TWinControl;
       const AParams: TCreateParams): HWND;
     var
    @@ -1347,6 +1369,7 @@
       with Params do
       begin
         pClassName := @EditClsName[0];
    +    SubClassWndProc := @MemoWndProc;
         WindowTitle := StrCaption;
       end;
       // create window
    
    win32wsstdctrls.pp.patch (1,215 bytes)

Activities

Felipe Monteiro de Carvalho

2010-10-13 18:20

developer   ~0041781

Confirmed with the latest 0.9.29 svn

Juha Manninen

2016-03-14 23:43

developer   ~0091048

I think this has been fixed a long time ago.

Bart Broersma

2016-11-13 19:02

developer   ~0095839

It flickers a lot at designtime (in IDE), but not at runtime.
(Lazarus 1.7 r53303 FPC 3.0.0 i386-win32-win32/win64)

Michl

2016-11-14 21:11

developer   ~0095871

Last edited: 2016-11-14 21:13

View 3 revisions

> It flickers a lot at designtime (in IDE), but not at runtime.

Here it flickers both, design- and runtime:
(64 and 32bit Windows 7, Lazarus r44303 (1.2.0) with FPC 2.6.2, Lazarus r49931 (1.4.4) with FPC 2.6.4, Lazarus 1.7 r53363 with FPC 3.1.1)

Also the caption of a TPanel has flickering.
The same test project has absolute no flickering in Linux Mint KDE GTK2.

Test project added.

Michl

2016-11-14 21:11

developer  

MemoTest.zip (3,305 bytes)

Michl

2016-11-15 09:30

developer   ~0095880

Here is a patch. I tested it on Windows 10 and Windows 7 (Classic and Aero theme). It works fine for that systems.

Michl

2016-11-15 09:30

developer  

win32wsstdctrls.pp.patch (1,215 bytes)
Index: lcl/interfaces/win32/win32wsstdctrls.pp
===================================================================
--- lcl/interfaces/win32/win32wsstdctrls.pp	(revision 53363)
+++ lcl/interfaces/win32/win32wsstdctrls.pp	(working copy)
@@ -1336,6 +1336,28 @@
 
 { TWin32WSCustomMemo }
 
+function MemoWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
+    LParam: Windows.LParam): LResult; stdcall;
+var
+  Control: TWinControl;
+  LMessage: TLMessage;
+begin
+  case Msg of
+    // prevent flickering, Mantis #0016140
+    WM_ERASEBKGND:
+      begin
+        Control := GetWin32WindowInfo(Window)^.WinControl;
+        LMessage.msg := Msg;
+        LMessage.wParam := WParam;
+        LMessage.lParam := LParam;
+        LMessage.Result := 0;
+        Result := DeliverMessage(Control, LMessage);
+      end;
+    else
+      Result := WindowProc(Window, Msg, WParam, LParam);
+  end;
+end;
+
 class function TWin32WSCustomMemo.CreateHandle(const AWinControl: TWinControl;
   const AParams: TCreateParams): HWND;
 var
@@ -1347,6 +1369,7 @@
   with Params do
   begin
     pClassName := @EditClsName[0];
+    SubClassWndProc := @MemoWndProc;
     WindowTitle := StrCaption;
   end;
   // create window
win32wsstdctrls.pp.patch (1,215 bytes)

Michl

2016-12-18 22:48

developer   ~0096920

Fixed in Trunk.

Please test and close if ok.

Issue History

Date Modified Username Field Change
2010-03-29 14:32 Christian New Issue
2010-03-29 14:32 Christian Widgetset => Win32/Win64
2010-10-13 18:20 Felipe Monteiro de Carvalho LazTarget => -
2010-10-13 18:20 Felipe Monteiro de Carvalho Note Added: 0041781
2010-10-13 18:20 Felipe Monteiro de Carvalho Status new => confirmed
2016-03-14 23:43 Juha Manninen Note Added: 0091048
2016-03-14 23:43 Juha Manninen Status confirmed => feedback
2016-11-13 19:02 Bart Broersma Note Added: 0095839
2016-11-14 21:11 Michl Note Added: 0095871
2016-11-14 21:11 Michl File Added: MemoTest.zip
2016-11-14 21:12 Michl Note Edited: 0095871 View Revisions
2016-11-14 21:13 Michl Note Edited: 0095871 View Revisions
2016-11-15 09:30 Michl Note Added: 0095880
2016-11-15 09:30 Michl File Added: win32wsstdctrls.pp.patch
2016-12-18 22:48 Michl Fixed in Revision => r53722
2016-12-18 22:48 Michl LazTarget - => 1.6.4
2016-12-18 22:48 Michl Note Added: 0096920
2016-12-18 22:48 Michl Status feedback => resolved
2016-12-18 22:48 Michl Fixed in Version => 1.7 (SVN)
2016-12-18 22:48 Michl Resolution open => fixed
2016-12-18 22:48 Michl Assigned To => Michl
2016-12-18 22:48 Michl Target Version => 1.6.4
2016-12-20 20:07 Michl Build => r53722, r53739