|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Vincent Wong
|
Mar 15, 2007 - 6:48 AM
|
Hi,
I have the following setup: I have a parent CExtResizableDialog, into which I place a CExtTabPageContainerWnd control. Each page of this control is another CExtResizableDialog instance. For each page, I’ve created anchors for the child controls, in the hope that the controls will move/resize properly.
When I resize the parent window, the CExtTabPageContainerWnd control resizes, as does the inner CExtResizableDialog page - I’ve confirmed that the client area of each page changes. However, despite adding the anchors in the OnInitDialog() function of each page, the controls fail to move/resize with the page. What might be going on here?
Jumping the gun a bit... I’ve had a look at the ProfUIS_Controls sample, and specifically at CPageTabContainers::OnInitDialog(), where the parent dialogue actually sets up the anchors for the page. I then noticed the calls to SubclassDlgItem(), called for each control on the page. Is this the key to it? If so, how does this mechanism work exactly?
I tried making similar calls, along the following lines:
m_themeSettingsPage.m_gridColours.SubclassDlgItem(IDC_GRID_COLOURS, &m_themeSettingsPage);
but this crashes, as m_gridColours already has a hWnd - it has already been created by the page dialogue: I’ve created a custom control using the Dialog Editor, then called DDX_Control() to create the CExtGridWnd.
Could you suggest the best way for me to achieve correct sizing of the page controls?
Thanks,
Vincent.
|
|
Vincent Wong
|
Mar 16, 2007 - 3:14 AM
|
Thanks for the reply.
Found the problem! The parent dialogue defined WindowProc(), handling the WM_PAINT message to paint the dialogue background a custom colour. For all other messages, I was calling CDialog::WindowProc(), not CExtResizableDialog::WindowProc(), completely bypassing the drawing of resizable controls. Slap on the wrists for that one...
|
|
Technical Support
|
Mar 15, 2007 - 2:25 PM
|
Subclassing has little to do with the anchoring algorithm. First please check if AddAnchor() methods are actually invoked. Then please check whether the page dialog is created as a child of CExtTabPageContainerWnd . If you have the same problem after that, please send us a project that demonstrates the problem so we can help you.
|
|