Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Challenging question about CButton class and arrays (please help)

Status
Not open for further replies.

Iceman55555

Programmer
Jan 26, 2002
1
US
Here is what I’m trying to do…


I create an array like this

CButton squareArray[8][8];

I create buttons (CButtons) for my dialog and I would like to put those buttons into an array. When I create variables that are assosicated with the buttons (in this case, I made a variable called m_button1), they are lines that look like this...

DDX_Control(pDX, IDC_BUTTON1, m_button1);

When I try to assign the array position to the button, I get an error. Here is the line that causes an error

squareArray[1][1] = m_button1;

After trying something like this, I get this error

error C2582: 'CButton' : 'operator =' function is unavailable

I'm guessing you just can't do it, but can anyone give me some help or suggest anything else I might be able to do?

I was thinking about somehow assigning the array position to the button ID. I tried something like this for the hell of it...

DDX_Control(pDX, IDC_BUTTON1, squareArray[1][1]);

but that didn't work at all! If anyone can help I would surely appriciat it!!!

Thanks to whoever can help!
 
Simply make your array an array of pointers to the CButtons.
eg;
CButton *squareArray[8][8];

Then to assign;
squareArray[1][1] = &m_button1;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top