Hi,
I traced the execution of my code and what the toolkit library does. The flow of function calls through my code is this:
CChildFrame::OnCreateClient: Creating control view 1 CCJ_XTResizeFormView::OnCreate: Enter 2 CCJ_XTResizeFormView::OnCreate: Designed width=222 height=650 3 CCJ_XTResizeFormView::OnSize: new width=222 height=650 4 CCJ_XTResizeFormView::OnInitDialog: Enter, window rect width=222 height=650 5 CCJ_XTResizeFormView::OnInitDialog: Enter, client rect width=222 height=650 6 CCJ_XTResizeFormView::OnInitDialog: Enter, init width=0 height=0 7 CCJ_XTResizeFormView::OnInitDialog: Enter, init width=0 height=0 8 CCJ_XTResizeFormView::OnInitDialog: After window rect width=222 height=650 9 CCJ_XTResizeFormView::OnInitDialog: After, client rect width=222 height=650 10 CCJ_XTResizeFormView::OnInitDialog: After, init width=222 height=650 11 CCJ_XTResizeFormView::OnInitDialog: After, min width=222 height=650 12 CCJ_XTResizeFormView::OnSize: new width=223 height=650
13 CChildFrame::OnCreateClient: Creating dummy view 14 CCJ_XTResizeFormView::OnSize: new width=223 height=430 |
On lines 3-4 this first OnSize shows the designed size of the form which is correct, and the controls will be created at their correct positions. I set up my resize items after line 11. Line 12 is the size message sent by the splitter using the sizes I specify at the start of this sequence (before line 1). Line 14 is the CScrollView base class trying to set various sizes.
If I set the size of the splitter pane to CSize(0,0) then the XTResize::Size() returns before doing anything. Similarly if I set the pane size to be the exact size required for the form view then XTResize::Size() returns before doing anything because it thinks the window size has not changed.
If I set the size to something different from the exact size (e.g. 1 pixel wider) then XTResize::Size() performs it's processing but then it sets the resize item's sizes to something incorrect (the degree of incorrect is determined by how different the sizes I specify are from the designed sizes) and sets their m_bInitialSize flag. The controls are then all resized from an incorrect base size.
Is there some way to force a call to Size() using the current window sizes as the initial size?
Edit: a bit of a hack, but I've just went through the m_arrItems setting their m_bInitialSize to true after I've set their resizes (since that finds their correct sizes without having to get a WM_SIZE message).
|