Working with C++ app, using MFC.
I have an aux dialog that is created as a secondary dialog to the main application dialog. This aux dialog has several buttons etc. as child controls. If I click on the aux dialog background or in its nonclient area, it comes to the top as expected. But if I click on one of the child buttons, the button functions correctly but the dialog doesn't come to the top.
Is there some event I should handle in the dialog to bring it to the top when any child control is clicked? Or perhaps set some property in the dialog that will ensure that happens?
I'm suspicious I need to handle some activate or focus event that I'm not. Or maybe once the children handle the click, it needs to be propagated up? Or the other way around?
EDIT: Additional details answering question in comment:
Main dialog class CMyDlg and aux dialog class CAuxDlg are both derived from CDialog.
A blank dialog resource exists for each; all child controls etc are created programmatically.
class CMyDlg : public CDialog
{
public:
CAuxDlg *aux;
...
protected:
virtual BOOL OnInitDialog()
...
DECLARE_MESSAGE_MAP()
}
class CAuxDlg : public CDialog
{
...
protected:
...
DECLARE_MESSAGE_MAP()
}
Aux dialog is created in main dialog's OnInitDialog() method:
BOOL CMyDlg::OnInitDialog()
{
...
aux = new CAuxDlg(this);
aux->Create(IDD_AUX_DIALOG, GetDesktopWindow());
...
}
In the aux dialog resource, all properties are FALSE except for:
- border: resizing
- style: popup
- title bar: true
- tool window: true
- use system font: true
SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW)
if needed, after clock on the control – Tom Tom