0

I have investigated this problem across some different computers with theming/classic-theme and/or theme support disabled in my app...

Problem when Windows is configured to draw the window while dragged + theme drawing enabled:

My primary app window stutters greatly when dragged around screen. It is even so bad that if I drag the window e.g. 10 inches left and releases mouse button... The Window will then continue to move around the screen for 2-5 seconds more!

Speculation #1 I think the message queue may be flooded with paint-message related stuff meaning the move-messages get delayed? (which then again causes paints) Maybe some postmessage/sendmessage queuing going wrong.

What I have tried I created some code that went through all controls in my form and disabled all events I could think of + called .Hide on them all -- this has no effect on the problem... However, I then created some code that went through all controls and removed them entirely -- this solves the problem if I remove say 50-80% of the controls.

Speculation #2 Is Windows draw style theming also done on controls not visible? (e.g. if placed on a TTabSheet not currently active?)

Other notes In all honesty my form is very large (I spit out 7 different tools which all use most of it)

It is possible a TFrame based solution - as long as not loaded into memory - could solve this. But there are many problem in this... For one I have not abstracted reading e.g. options... I.e. I read myCheckbox.Checked to determine if a given option is enabled before passing it on my separated business logic.

But it is possible if I had a layer inbetween I could load TFrames as necessary... But it will be major work to convert to this.

...

Any ideas on how to workaround this? Reducing the problem is enough... I am thinking about: a) Removing what I can. b) Replacing what I can with stuff not style theme drawn. (E.g. "debug" controls I use myself to understand what is going on) c) Maybe loading some stuff in TFrame instead d) Trying to figure out why invisible controls cause problems for the style theme drawing... Could I have them ignored somehow? e) Disable themning while drawing? f) Disable having window drawn while dragged even if Windows is configured to draw Windows while they are being dragged. g) WM_WINDOWPOSCHANGING / WM_WINDOWPOSCHANGED and disable align + draw while it happens.

Tom
  • 3,587
  • 9
  • 69
  • 124
  • 1
    A sampling or other profiler will tell you what your application is spending the most time doing which could offer some insights into what is going on when you drag it. – Brian Nov 05 '20 at 19:39
  • I have an AQTime6 license but it won't install on my Windows 10 due to MSI installer errors, but I am planning on doing this if a solution does does not present itself. (My code also compiles and exhibits same problem when using Delphi 2010 so it is viable,) – Tom Nov 05 '20 at 19:42
  • 1
    How do we reproduce this issue? I've not seen it in any of my apps. – Ken White Nov 06 '20 at 03:17
  • Does it help if I make a video? I have some other applications built using same code but where the forms contain far less controls, so the problem does not happen. The problem also does appear to happen on WinXP with WinXP theme, at least not noticiable the same way. Those fact together with my experiments showing it helps deleting controls that are not visible (controls placed on non-selected tabs) makes me think there maybe is something in the theming/styling code or Windows (handles?) that increases the problem. – Tom Nov 06 '20 at 09:11

0 Answers0