PDA

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



coda
10-26-2003, 03: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()
{
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:
}

mikael_aronsson
10-26-2003, 08: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.

Mikael

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

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

CWhat Cis Cwrong Cwith Cit C?

10-26-2003, 10: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:




if(state==TRUE)


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