Home > Software engineering >  MFC drop-down box focus problem
MFC drop-down box focus problem

Time:09-25

I have a program interface, there is a MFC Combobox controls, such as


When I click on the margin of the interface, the mouse wheel rolling in, the value of the Combobox control will change,

Users don't want this, now is to click on the blanks, roll the middle mouse button, Combobox don't response, the focus is not on the control, and should in the margins of window screen,

How to do?

CodePudding user response:

You can set the focus of the Combobox through setfocus (false)

CodePudding user response:

reference 1st floor usecf response:
you can set the focus of the Combobox through setfocus (false)


MFC controls no setfocus (false) this interface!

CodePudding user response:

: : SetFocus (NULL);

CodePudding user response:

 
Void CDlg5Dlg: : OnLButtonDown (UINT nFlags, CPoint point)
{
//TODO: Add your message handler code here and/or call the default
TRACE (_T (" CDlg5Dlg: : OnLButtonDown \ n "));

The CWnd * pFocus=GetFocus ();
If (pFocus)
{
The CWnd * pParent=pFocus - & gt; GetParent ();
If (pParent & amp; & PParent - & gt; M_hWnd==m_myCombox. M_hWnd)
{
: : SetFocus (NULL);
}
}

CDialog: : OnLButtonDown (nFlags, point);
}

CodePudding user response:

In other controls the focus in the past
  • Related