views:

146

answers:

1

I'm considering to increase my usage of DeferWindowPos. Up to now I used it in some simple circumstances and didn't notice any problems. Do you know of any pitfalls, where e.g. the FLeft/FTop/... fields aren't updated correctly or similar things?

+6  A: 

DeferWindowPos should't be a problem because the WM_WINDOWPOSCHANGED, WM_MOVE and WM_SIZE messages are still sent after the move/resize is finished. DeferWindowPos works as if the user moves or resized the window and the VCL keeps track of all the changes and updates FLeft, FTop, FWidth and FHeight properly.

Andreas Hausladen
Remember that each window being resized/moved has to share the same parent in order for DeferWindowPos to work. This is a Windows requirement, not something that VCL would require.
Allen Bauer
+1. I never had any problem with that function. One obvious caveat is that the controls being moved must have window handles, so that rules out things like TLabel and TImage. That was never really a problem for me, though.
Rob Kennedy