how to set state variable so that graphic will appear later?

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()
{
BOOL state=FALSE;

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

This is to draw the rect when dialogA is closed on clicking OK button
void CDialogA::OnOK()
{
CDialog::OnOK();
state=TRUE:
}

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.

Mikael

You’re coding style makes me hurl.

Originally posted by Andrewinator:
You’re coding style makes me hurl.

CWhat Cis Cwrong Cwith Cit C?

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:

 if(state==TRUE)

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