-
April 29th, 2020, 09:39 AM
#1
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.
-
April 29th, 2020, 01:20 PM
#2
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?
-
April 29th, 2020, 02:21 PM
#3
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
 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?
Victor Nijegorodov
-
April 29th, 2020, 08:57 PM
#4
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
No its unique it doesn't conflict with other resource id.
-
April 29th, 2020, 09:00 PM
#5
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
It fails at line DDX_CONTROL(pDX, IDC_COMBO_FOUR, combo_four.
-
April 30th, 2020, 01:37 AM
#6
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?
Victor Nijegorodov
-
April 30th, 2020, 04:04 AM
#7
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Yes it belongs to combobox and combobox belongs to MyDialog
-
April 30th, 2020, 04:11 AM
#8
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
Could you post your project? (in .zip archive, without debug. release, .vs folders)
Victor Nijegorodov
-
April 30th, 2020, 09:39 AM
#9
Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed
 Originally Posted by Beginner_MFC
error of assertion failed comes.
What text (exactly!) do you see?
 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?
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|