Madz
Madz

Reputation: 1279

Add variable to mfc dialog control

This is a very simple problem, but I could not find a solution to it. I have a dialog A, which when clicked a button opens another dialog B with a single edit box. I want to add an integer variable to it.
The usual way of adding variables which is right clicking the edit box and "add variable" is greyed out. I presume that it's because I haven't declared a separate class for the dialog, since the variable is used only in Dialog A code I don't want to add a separate class for Dialog B.
What should I do?

Thanks.

Upvotes: 0

Views: 1685

Answers (1)

Roger Rowland
Roger Rowland

Reputation: 26259

If you want to customise the behaviour of dialog B in any way (including adding variables for controls), you must declare a class for it.

You say that the variable is only used in dialog A code, but that doesn't mean that dialog A is the owner of that variable. Dialog B owns it, so dialog B needs a class.

Upvotes: 1

Related Questions