15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dialog box is not enabled

Roland Pasternack -- rpasternack@MSERVER2.Legato.COM
Monday, April 15, 1996

Visual C++ 4.1, NT 3.51

I am doing a vanilla dialog box that is derived from CDialog.  For this 
problem, the dialog box *only* has OK and Cancel buttons.  The ctor does 
*nothing*.  OnInitDialog does this:

BOOL CClientDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    CenterWindow();
    return (TRUE);
}

The very first time, and *only* the very first time the dialog box is 
displayed, it is not enabled.  Neither the tab keys, or even clicking on any 
of the buttons works (when clicking on the buttons, they don't even move).  If 
I click on any other application and then click back, the dialog then works.

I came up with a workaround of adding:

GetDesktopWindow()->SetFocus();
SetFocus();

to the OnInitDialog() code.  This works, but is a real kludge.

The parent of this dialog box is a CView derived object, which itself fills 
the client area of an MDI child window.  I suspect the problem relates to the 
parent trail, because I have never seen a problem like this in simpler 
layouts.

Has anyone seen a problem like this, or have an idea of what may be wrong?

Thanks,
Roland




Uma Shankar -- Uma_Shankar@countrywide.com
Monday, June 17, 1996

I faced the problem similar to you.  The workaround i  used in the view class 
is:

HWND hWnd = GetCapture();
if (::IsWindow(hWnd))
  ReleaseCapture();

dialog.DoModal() // DoModal of CDialog Deriver class

if (::Iswindow(hWnd))
ResetCapture(hwnd);


>

Visual C++ 4.1, NT 3.51

I am doing a vanilla dialog box that is derived from CDialog.  For this 
problem, the dialog box *only* has OK and Cancel buttons.  The ctor does 
*nothing*.  OnInitDialog does this:

BOOL CClientDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    CenterWindow();
    return (TRUE);
}

The very first time, and *only* the very first time the dialog box is 
displayed, it is not enabled.  Neither the tab keys, or even clicking on any 
of the buttons works (when clicking on the buttons, they don't even move).  If 
I click on any other application and then click back, the dialog then works.

I came up with a workaround of adding:

GetDesktopWindow()->SetFocus();
SetFocus();

to the OnInitDialog() code.  This works, but is a real kludge.

The parent of this dialog box is a CView derived object, which itself fills 
the client area of an MDI child window.  I suspect the problem relates to the 
parent trail, because I have never seen a problem like this in simpler 
layouts.

Has anyone seen a problem like this, or have an idea of what may be wrong?

Thanks,
Roland
>
 





| Вернуться в корень Архива |