onlick event of command button is not called
-
I have one propertypage and it has the 10 radio button and two command button. All buttons has the onclick event function. My problem is two command button event is not called. I checked the message map area. Its looking fine. I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete. resource.h has the control Id. Some other dialog also has the control with same ID, there the event is occured. Anybody suggest me what could be the problem?
-
I have one propertypage and it has the 10 radio button and two command button. All buttons has the onclick event function. My problem is two command button event is not called. I checked the message map area. Its looking fine. I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete. resource.h has the control Id. Some other dialog also has the control with same ID, there the event is occured. Anybody suggest me what could be the problem?
ganesh.dp wrote:
I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete.
There's something weird in that. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I have one propertypage and it has the 10 radio button and two command button. All buttons has the onclick event function. My problem is two command button event is not called. I checked the message map area. Its looking fine. I can't simply add another control and compile it. Because it's huge lib, I have to wait 10 hours to complete. resource.h has the control Id. Some other dialog also has the control with same ID, there the event is occured. Anybody suggest me what could be the problem?
Assign unique value for duplicated id, simply. You should assign all unique (different) id for different controls. Only one handler will be called for one id value on MFC message mapping. Because MFC's message mapping is very simple implement which using array of struct, and decide handler by sequential searching. When message map is as below;
BEGIN_MESSAGE_MAP(CSampleDlg, CDialog)
//{{AFX_MSG_MAP(CSampleDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()Compiler recognize as below; (rewriting simply)
struct MessageEntry messageEntries[] = {
{ IDC_BUTTON1, OnButton1 },
{ IDC_BUTTON2, OnButton2 }
};If IDC_BUTTON1 and IDC_BUTTON2 are equal, the sequential searching algorithm always find OnButton1 for IDC_BUTTON{1,2}.