I know there are lots of articles on this in CodeGuru and the like, but
they don't quit fit the bill.
CListWindow is a dialog box that contains nothing but an edit control. I
want the control to fill the dialog window, and I want it resizable.
When I create the dialog, I set the frame type to resizable and add an
OnSize handler. The handler looks like
void CListWindow::OnSize(UINT nType, int cx, int cy)
CDialog::OnSize(nType, cx, cy);
m_edit_control.MoveWindow(0, 0, cx, cy);
m_init is a bol that is initialized to false, set to true in
OnInitDialog. This is necessary because OnSize appears to be called
during creation, before the edit control is created.
So far, so good. The control resizes as the dialog window is sized. One
problem - When the dialog first appears, the edit box is as big as it is
drawn in the visual layout. The layout leaves a border of ~15 pixels
(what's this frame called?) in the dialog where you can't put controls.
When the window is resized, the control fills this area.
How to fix this?
One way is to keep the control from expanding into this frame area. If
so, how do you get the width of this frame?
I prefer the look of the fully expanded box. How do I invoke the
m_edit_control.MoveWindow() during the dialog creation, *after* the
control has been created? I know I could probably do this by creating
CFullSizeEdit, inheriting from CEdit, then putting what I need in the
Create or something like that. I would prefer not to go this route. I
would prefer the handling to occur in the dialog class.