Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to set the max and min option for a dialog

Status
Not open for further replies.

kaya17

Programmer
Feb 9, 2004
78
SG
hi, i got a dialog,
and i already checked the boxes "Minimize box" and "Maximize box" in the styles tab under the Dialog Properties.
so, the minimize and maximize icons do appear in the right up corner of the dialog.

however, after clicking the maximize icon. only the dialog is maximised, the contents within the dialog ( a clistctrl and some buttons) still remain the same size and same position.

then, i added the following funtion to the dialog class:

void CReadDBDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);

// TODO: Add your message handler code here
GetDlgItem(IDC_ListControl)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);

GetDlgItem(IDC_BUTTON_PRINT)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);


GetDlgItem(IDC_READ)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);


GetDlgItem(IDC_Query)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);


GetDlgItem(IDC_INSERT)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);

GetDlgItem(IDC_DELETE)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);

GetDlgItem(IDC_BUTTONSCAN)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);

GetDlgItem(IDOK)->SetWindowPos(NULL,0,0,cx -5, cy -5,
SWP_NOMOVE | SWP_NOZORDER);
}

then, when execute it, it gave an assertion error.
saying something
ASSERT:):IsWindow(m_hWnd)
.....


anybody could tell me what's wrong here?

Thanks a lot in advance :)

kaya
 
It is calling OnSize before you have it fully created. add the following after your "TODO"

if(m_hWnd)
{
// rest of your code
}

You are acting upon a control that you can not yet act upon.

Matt
 
hi, i did as what you said, but still it said ASSERT:):IsWindow(m_hWnd));


:(

and what should i if i want it to be maximised when it is first launched?

thanks!

KAYA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top