MFC: Visual Studio Resource Editor Class Wizard doesn't have all control IDs under Member Variables

406 views Asked by At

I've run into this a few times, don't recall what I did to fix it last time (probably started all over). Here's what I did:

I copied an existing CMFCPropertySheet dialog box and pasted as new one then edited the dialog ID to IDD_MINE, deleted all the controls as a starting place. Next I added the various controls for the this dialog.

After setting up the dialog the way I wanted it, I went to "Add Class" and added a class for the dialog (choosing the base class CMFCPropertySheet). When it was done, it was incorrect (VS2017 has never done the property sheet correct for me). Referencing another property sheet that I have working, I added the missing IDD_MINE to the constructor and the AFX_DESIGN_TIME { enum IDD=IDD_MINE }.

Once the class was setup I was ready to start adding variables. However I noticed some of the controls that were a checkbox should have been a radio button so I deleted them, created radio buttons (push like) then choose the existing IDC_ names (old checkbox names) from the dropdown list for the control id. Next I try to add the first radio button as a value variable but that fails with the following error:

Object reference not set to an instance of an object.

So I go to the Class Wizard for the Dialog and look in "Member Variables" tab. It lists all the controls IDs except the radio buttons (and IDC_STATIC items that are -1) . I tried renaming the radio buttons by changing the IDC_ names but that didn't change anything (exit program, etc.., still same).

So does someone know how I get visual stdio resource editor / class wizard back in sync with the controls that really exist so I can add them using the wizard?

TIA!!

EDIT:

Even those variables which exist in the "Member Variables" tab can't be used with the wizard. Same Object Reference not set to instance of an object message.

So being desperate, I manually added the function:

virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

Everything works now!!

Which the wizard would take care of all this on its own.

0

There are 0 answers