how can I get Push button setfocus event
-
Hi, I have created MFC application.I am having 2 Dialog boxes.If I click "Add" button(push button) on first Dialog second dialog will open.After canceling of second dialog once again focus is coming on Add Button.At that time I need to refresh my list box,which is on first dialog. I need to get focus of Add button.So I have created small program like this
BEGIN_MESSAGE_MAP(CMyThreadDlg, CDialog)
ON_BN_SETFOCUS(IDC_BUTTON2, &CMyThreadDlg::OnBnSetfocusButton2)
END_MESSAGE_MAP()void CMyThreadDlg::OnBnSetfocusButton2()
{
// TODO: Add your control notification handler code here
MessageBox(_T("Focus"));
}If I click on that button focus is coming but function is not calling.Can anyone help me.
-
Hi, I have created MFC application.I am having 2 Dialog boxes.If I click "Add" button(push button) on first Dialog second dialog will open.After canceling of second dialog once again focus is coming on Add Button.At that time I need to refresh my list box,which is on first dialog. I need to get focus of Add button.So I have created small program like this
BEGIN_MESSAGE_MAP(CMyThreadDlg, CDialog)
ON_BN_SETFOCUS(IDC_BUTTON2, &CMyThreadDlg::OnBnSetfocusButton2)
END_MESSAGE_MAP()void CMyThreadDlg::OnBnSetfocusButton2()
{
// TODO: Add your control notification handler code here
MessageBox(_T("Focus"));
}If I click on that button focus is coming but function is not calling.Can anyone help me.
Why do you need to refresh your listbox when your add button gets focus? I am just guessing but i believe what you want is to refresh your list when your second dialog is closed. If it is a modal dialog then all you need to do is refresh your list after your second dialog's DoModal returns.
void CMyThreadDlg::OnPressedAddButton()
{
CMySecondDialog Dlg(this);
Dlg.DoModal();
RefreshMyListNow();
}If you insist on the focus change maybe try using
ON_BN_SETFOCUS(IDC_BUTTON2, OnBnSetfocusButton2)
instead ofON_BN_SETFOCUS(IDC_BUTTON2, &CMyThreadDlg::OnBnSetfocusButton2)
, does that help?> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Why do you need to refresh your listbox when your add button gets focus? I am just guessing but i believe what you want is to refresh your list when your second dialog is closed. If it is a modal dialog then all you need to do is refresh your list after your second dialog's DoModal returns.
void CMyThreadDlg::OnPressedAddButton()
{
CMySecondDialog Dlg(this);
Dlg.DoModal();
RefreshMyListNow();
}If you insist on the focus change maybe try using
ON_BN_SETFOCUS(IDC_BUTTON2, OnBnSetfocusButton2)
instead ofON_BN_SETFOCUS(IDC_BUTTON2, &CMyThreadDlg::OnBnSetfocusButton2)
, does that help?> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <