View Full Version : how to set state variable so that graphic will appear later?

10-26-2003, 02:29 AM
My SDI has a dialog A which takes in user input like length and breadth of a rect. After this dialog is closed then only will the rect appear in the SDI view. But I tried setting the state so that it will appear at the appropriate time and i encountered those assertion error, what is the correct way to do this?

void CView::OnPaint()

if (state=TRUE)
{ m_dialogA.OnDraw;}

This is to draw the rect when dialogA is closed on clicking OK button
void CDialogA::OnOK()

10-26-2003, 07:09 AM
The code you posted does not work anyway, you declare a local variable BOOL state... and then you change a variable with the same name in another method, I assume this is an instance variable... either way it does not work.

You would probably need to add an InvalidateRect( NULL) call after you change the state variable also to make sure the window is updated.


10-26-2003, 08:26 AM
You're coding style makes me hurl.

10-26-2003, 11:17 AM
Originally posted by Andrewinator:
You're coding style makes me hurl.

CWhat Cis Cwrong Cwith Cit C?

10-26-2003, 09:45 PM
Aside from whats beeing said already (local variable used globaly)

Originally posted by coda:
if (state=TRUE)

You are assign "TRUE" to the variable "state", you dont compare them. That would look like this:


No offense but you may want to improve your C/C++ skills a bit before you start with OpenGL (or MFC).