regarding command button usage
i wished to exchange the data of my dialog box to variables only if the user clicks on the OK command button and not if he clicks on CANCEL button
My code is
Code:
busd.DoModal ();
if(busd.m_ok )
{
int index=pDoc->GetBusIndex (m_BusNo);
BusSize=atol(busd.m_size);
m_BusNo=busd.m_busno;
m_BusType=busd.m_bustype;
m_Volts=busd.m_voltage;
m_LoadAngle=busd.m_loadangle;
m_BusName=busd.m_busname;
z=b->m_size;
ltoa((b->m_BusNo),temp,10);
m_BusNo=temp;
pDoc->AppendBus(busindex,b->m_x1 ,b->m_y1 ,b->m_x2 ,b->m_y2 ,z,atol(m_BusNo),b->m_bOrien ,m_BusType,m_Volts,m_LoadAngle,m_BusName);
}
above m_ok is variable that i have attached to command button and is of category "control" .....it never goes into this loop......kindly please tel what modifications i need to do??
Re: regarding command button usage
What do you expect this does ? What it really does, it checks if the pointer to m_ok is still there.. .but it isn't because after DoModal () all resources are destroyed.
DoModal () has a return value... you can use it to determine what button was pressed.