Snipped code: Automatic resizing a dialogbox

From: Mélice <mail_at_forthcad.com>
Date: Fri, 26 Nov 1999 14:47:28 +0100

I have found the following definition usefull when defining dialogbox
controls on the fly = controls defined with "CreateWindowEx" in the
WM_INITDIALOG event.

Put 'AutoSizeDialog' in the WM_INITDIALOG msg, after the controls creation
process. The dialog autosize to fit the controls.

    : AutoSizeDialog ( hDlg -- )
        4 CELLS R-ALLOC 0 0 LOCALS| cx cy rect hDlg |
        hDlg GW_CHILD GetWindow
        BEGIN DUP WHILE
            DUP rect GetWindowRect DROP
            rect @RECT
            cy MAX TO cy cx MAX TO cx
            2DROP
            GW_HWNDNEXT GetWindow
        REPEAT
        DROP
        hDlg DUP rect GetWindowRect DROP
        rect @RECT 2DROP 2DUP
        cx ROT - SM_CXICON GetSystemMetrics +
        cy ROT - SM_CYICON GetSystemMetrics +
        TRUE MoveWindow DROP ;

Charles

.
Received on Fri Nov 26 1999 - 14:47:28 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 07-Feb-2012. Archive updated nightly.