Hi All,

Man I love ASM! There's usually about a dozen ways of doing the same thing, and if you're lucky and your combination of controls, API choices, message handling routines, and the phase of the moon is correct it works. If not...

I'm having battles lately with some resizing/flicker issues and thought there might be a somewhat 'definitive' way of handling it. I have a window with menu and rebar/toolbar, and on that window is a Tab control, and on that tab control is a Listview. The listview I subclass so I can create a popup menu and handle the WM_CONTEXTMENU message.

Originally I just had the listview without the tab control and to prevent flicker I used a paint screen routine drawing on a compatible bitmap a la the ESF example by Chris Hobbs. This worked fine, I used MoveWindow in the WM_SIZE routine to position the Listview properly below the toolbar and then called the paint screen routine to eliminate the flicker.

My problems now arise when I add the Tab control and put the Listview on top of it. I can't seem to resize both the tab control AND the listview. If I use either one of them separately my resizing/flicker strategy seems to work, i.e. the tab control behaves properly by itself, or the listview behaves OK without the tab control. But if I put the 2 of them together all hell breaks loose. There seems to be a competition between the 2 controls as I resize, sometimes I can see the Tab control tab being redrawn OK and then it apparently gets overdrawn by the Listview.

Let's say I eliminate the paint screen routine entirely, I don't really care about the flicker at this point, and just concentrate on the WM_SIZE messaging routine. If I have 2 MoveWindow calls which handle controls which are essentially on top of each other, what would be the best way to use them so they don't compete with each other?

invoke MoveWindow, hTab,0,eax,ebx,edx,TRUE
; reduce the width of the listview so it's
; just inside the tab control
sub ebx,4
invoke MoveWindow, hListView,2,eax,ebx,edx,TRUE

The other problem I know I'm going to have down the line is when there are multiple tabs and each of those need to be included in the resizing/flicker routines.

Any ideas on the best way to handle this, or am I needlessly making my life difficult? Thanks for any advice.

Posted on 2002-02-03 23:39:56 by Kayaker
a good way is often, to forbid all redrawing with WM_SETREDRAW (FALSE),

then do all sizing / moving
then allow redraw WM_SETREDRAW (TRUE) and make a repaint on the whole window (InvalidateRect - UpdateWindow)

this works proper for me in some similar cases.
Posted on 2002-02-04 03:34:35 by beaster
Thanks for the reply beaster. I had set the bRepaint flag of MoveWindow to FALSE because I understood you don't want the WM_PAINT message being called if you are repainting yourself, but it didn't seem to make a difference. I will definitely try your WM_SETREDRAW idea. I need to step back and take a fresh look at my whole repainting scheme and will try implementing it when I've restructured my code. In the meantime I've totally muddled myself up in where I'm at, lol, so I'm going to start fresh.

Posted on 2002-02-05 20:47:35 by Kayaker
my experience with listviews in tabcontrols (or "dialogs" in tabcontrols) is: you should not resize the child (listview/"dialog") with MoveWindow but with

invoke SetWindowPos, hWnd, HWND_TOP, x, y, _dx, dy, SWP_SHOWWINDOW

that is: use flag HWND_TOP

Posted on 2002-02-06 03:28:10 by japheth