Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
I have a CDialog , i decleared the Combobox in .rc file , i can see that combobox on screen but as soon as i do DDX mapping of this combobox , dialog dont open and produces asseetion failed. I have added other combobox in same dialog but addidtion of this combobox produces above mentioned problem.Sample code are below:
Code:
// Mydialog.h
CComboBox combo_one ;
CComboBox combo_two;
CComboBox combo_three;
CComboBox combo_four;
//MyDialog.cpp
Code:
void MyDialog :: DoDataExchange(CDataExchange* pDX)
{
DDX_Control(pDX, IDC_COMBO_ONE, combo_one);
DDX_Control(pDX, IDC_COMBO_TWO, combo_two);
DDX_Control(pDX, IDC_COMBO_THREE, combo_three);
DDX_Control(pDX, IDC_COMBO_FOUR, combo_four);
}
//Mydialog.rc
Code:
COMBOBOX IDC_COMBO_ONE, 10.,20,30,40, CBS_DROPDOWN
COMBOBOX IDC_COMBO_TWO, 20.,30,30,40, CBS_DROPDOWN
COMBOBOX IDC_COMBO_THREE, 30.,40,30,40, CBS_DROPDOWN
COMBOBOX IDC_COMBO_FOUR,40,50,30,40, CBS_DROPDOWN
i am getting no error when i added and mapped IDC_COMBO_ONE, IDC_COMBO_TWO,IDC_COMBO_THREE but as soon as i mapped IDC_COMBO_FOUR in DoDataExchange , error of assertion failed comes.
I debugged and found that when i hover combo_four variable during debug its hwnd is null while other three varaible have some memory.
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
What is tue resource ID of IDC_COMBO_FOUR ? Does it conflict with other resource IDs?
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Quote:
Originally Posted by
Beginner_MFC
... as soon as i mapped MBO_FOUR in DoDataExchange , error of assertion failed comes.
I debugged and found that when i hover combo_four variable during debug its hwnd is null while other three varaible have some memory.
Where exactly "assertion failed" happens?
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
No its unique it doesn't conflict with other resource id.
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
It fails at line DDX_CONTROL(pDX, IDC_COMBO_FOUR, combo_four.
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Is the IDC_COMBO_FOUR associated with a combobox?
Does this combobox belong to your dialog?
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Yes it belongs to combobox and combobox belongs to MyDialog
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Could you post your project? (in .zip archive, without debug. release, .vs folders)
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Quote:
Originally Posted by
Beginner_MFC
error of assertion failed comes.
What text (exactly!) do you see?
Quote:
Originally Posted by
Beginner_MFC
I debugged and found that when i hover combo_four variable during debug its hwnd is null while other three varaible have some memory.
Sure it is NULL! just because this control has not been subclassed yet!
So how about sending the test project?