News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Control Redraw

Started by zemtex, December 25, 2010, 01:32:30 AM

Previous topic - Next topic

zemtex

Hi. I have a modal dialog as main window by using DialogBoxParam

My edit controls, button controls all lack the framework graphics when the program starts up, only when I move my mouse button above the control will it redraw itself and then become "graphically complete".

If I do a InvalidateRect it will update all controls, but the problem is if you animate the window, the controls look incomplete before the animation is complete, and when the animation is complete the controls update, making it all visible, like some sort of animation going on. Is there a windows api function available for updating and redrawing all controls before the modal dialog window shows? Can I redraw the controls behind the scene someway?
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

Gunner

Are you processing WM_PAINT in your dialog proc?  If so, you should return TRUE, and for all other messages you do not handle (the ones that "pass through" your dialog proc) you have to return FALSE.  Could that be the problem?
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

zemtex

I am not processing WM_PAINT and the return values is ok.

I am animating the window (With fading of 200 millisecond) in the WM_INITDIALOG message handler, should I remove it to another place perhaps?

Perhaps I should move AnimateWindow from WM_INITDIALOG to WM_SHOWWINDOW ?

Never mind, I simply removed the animation and its solved now.
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

MichaelW

My test worked as expected with AnimateWindow.

;=========================================================================
    include \masm32\include\masm32rt.inc
;=========================================================================
    .data
        hInstance dd 0
    .code
;=========================================================================

DialogProc proc hwndDlg:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD

    SWITCH uMsg

        CASE WM_INITDIALOG

            invoke AnimateWindow, hwndDlg, 2000, AW_BLEND or AW_ACTIVATE

        CASE WM_COMMAND

            .IF wParam == IDCANCEL
                invoke EndDialog, hwndDlg, 0
            .ENDIF

        CASE WM_CLOSE

            invoke EndDialog, hwndDlg, 0

    ENDSW

    xor eax, eax
    ret

DialogProc endp

;=========================================================================
start:
;=========================================================================

    invoke GetModuleHandle, NULL
    mov hInstance, eax

    Dialog "Test", \
           "MS Sans Serif",10, \
           WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \
           1, \
           0,0,100,75, \
           1024

    DlgButton "&OK",WS_TABSTOP,35,40,25,12,IDCANCEL

    invoke Sleep, 1000

    CallModalDialog hInstance,0,DialogProc,NULL

    invoke ExitProcess, eax

;=========================================================================
end start


Do your controls have both the WS_VISIBLE and WS_CHILD styles?

eschew obfuscation

zemtex

WS_VISIBLE was one of them but not WS_CHILD. How important is the latter when using a modal dialog as main window?
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

MichaelW

QuoteHow important is the latter when using a modal dialog as main window?

Surprising to me, in my simple test removing the WS_CHILD style did not make any difference that I could detect. But I suspect that at least under some conditions it will make a difference, for example when tabbing between controls or when used in combination with WS_CLIPCHILDREN or WS_CLIPSIBLINGS. Removing it did not cause the problem that you described.
eschew obfuscation