Re: Focus Problem with Property Pages
The problem here is that when the you get notified about the double click,
the last WM_LBUTTON up has not been processed yet, and because of that the
focus is taken away from the dialog.
The easiest way to solve this problem is instead of showing the dialog in
your NM_DBLCLK handler is to set a timer and display the dialog later.
#define IDT_SHOWDLG 100
void CTreeTestDlg::OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
SetTimer(IDT_SHOWDLG,0,NULL);
*pResult = 0;
}
void CTreeTestDlg::OnTimer(UINT nIDEvent)
{
if (nIDEvent == IDT_SHOWDLG)
{
KillTimer(IDT_SHOWDLG);
m_Dlg.ShowWindow(SW_SHOW);
}
CDialog::OnTimer(nIDEvent);
}
AliR.
"Aniruddha" <anir123@gmail.com> wrote in message
news:1147181414.840572.275210@y43g2000cwc.googlegroups.com...
Hi all,
I'm creating a Property sheet with a page which has a tree control in
MFC.
On double clicking on a node in tree, I'm creating a modeless pop up
dialog box.
The dialog is displayed correctly but I'm not able to get focus on the
newly created dialog using SetFocus or SetForegroundWindow.
Thanks in advance