Help with making minimum size work for a dialog...

zsouthboy

Regular
I tried using the information here in my existing dialog, but it didn't work, so I tried making a blank new project dialog box, and it still doesn't work.

The user can shrink / resize a frame window to practically show nothing, hiding controls, toolbars, menus, grids and even inner dialogs.



To prevent this, the minimum size can be specified for the frame.







1) add point member variable



2) add getminmaxinfo message handler function, declaration and definition



3) initialize the minimum point member variable in the constructor, the number has to be adjusted according to the size you want to appear(test).





////class

class CMainWnd : public CFrameWnd

{

...



POINTptDontLetItGetSmallerThanThis;



...



DECLARE_MESSAGE_MAP()

// Generated message map functions

//{{AFX_MSG(CMainWnd)

....

afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);

//}}AFX_MSG

....

}







/////constructor



CMainWnd::CMainWnd(...)

{

...



ptDontLetItGetSmallerThanThis.x=675;//width

ptDontLetItGetSmallerThanThis.y=500;//height

.....

}







////set the minimum

void CMainWnd::OnGetMinMaxInfo(MINMAXINFO* lpMMI)

{

lpMMI->ptMinTrackSize =

ptDontLetItGetSmallerThanThis;

}


What am I doing wrong? I followed the instructions.

Here is the blank dialog box, with the above code used.
 
zsouthboy said:
What am I doing wrong? I followed the instructions.

MFC strictly sucks. it's among the worst OO, message-driven frameworks ever devised by humas. avoid whenever possible. as about what you did wrong, you've omitted the WM_GETMINMAXINFO from CWTFDlg's mesage map* - a typical mistake under MFC.


* it should look like
Code:
BEGIN_MESSAGE_MAP(CWTFDlg, CDialog)
	//{{AFX_MSG_MAP(CWTFDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_WM_GETMINMAXINFO()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
 
Back
Top