Dialog::Rollup

Description

Rolls up or down a dialog window

Syntax

BOOL Rollup( BOOL bClose = TRUE )

Parameters

bClose
When true will, if not already rolled up, rolls up the dialog to a minimal size. Rolls down to normal size when false.

Return

returns non zero when operation succeedes else zero.

Examples

To run this example, put codes in a c file under \OriginC\Originlab folder.

class TestRollUpDlg : public ResizeDialog
{
public:
        TestRollUpDlg() : ResizeDialog( IDD_SIMPLEBOX, "ODlg8" )
        {
        }
        int        DoModalEx(HWND hParent)
        {
                InitMsgMap();
                return DoModal(hParent);
        }
        
protected:    
EVENTS_BEGIN
        ON_INIT( OnInitDialog )
        ON_SYSCOMMAND(OnSystemCommand)//mostly on minimize/maxmize event
        ON_CLICK_KEY(OnKey)//on dialog rolling up
EVENTS_END

        BOOL OnInitDialog()
        {
                //add minimize and maxmize buttons
                ModifyStyle(0, WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
                return TRUE;
        }
        bool OnSystemCommand(int nCmd)
        {
                out_int("OnSystemCommand=", nCmd);
                
                if( SC_MINIMIZE == nCmd)
                {
                        BOOL bClose = !IsRolledup();
                        Rollup(bClose);
                        return FALSE;
                }
                return TRUE;
        }
        BOOL OnKey(BOOL bRollingUp)
        {
                out_str(bRollingUp?"RollingUp":"RollingUp false");
                return TRUE;
        }
};


void open_rollup_dlg()
{
        TestRollUpDlg myDlg;
        HWND hWnd = GetWindow();
        int nRet = myDlg.DoModalEx(hWnd);
}

Remark

See Also

Dialog::IsRolledup

header to Include

Dialog.h