|
[code]/ show "yes/no" question to user
void AsdkDataManager::documentToBeDeactivated(AcApDocument* doc)
{
// show message
m_bSwitchOutToOtherDrawing = true;
m_sFileNameBeDeactivated = _T("\0");
CString sMsg = _T("Do you want to switch to other drawing?");
if(AfxMessageBox(sMsg, MB_YESNO | MB_ICONQUESTION) == IDYES)
{
m_bSwitchOutToOtherDrawing = true; // switch to other drawing
}
else
{
m_bSwitchOutToOtherDrawing = false; // don't switch
m_sFileNameBeDeactivated = doc->fileName();
}
}
// reactivate previous drawing
void AsdkDataManager::documentToBeActivated(AcApDocument* doc)
{
if (m_bSwitchOutToOtherDrawing) // switch to other drawing
{
}
else //
{
if (!m_sFileNameBeDeactivated.IsEmpty())
{
AcApDocument* pDocReActive = NULL;
getDocFromFilename(m_sFileNameBeDeactivated, pDocReActive);
if (pDocReActive)
{
Acad::ErrorStatus es;
m_bSwitchOutToOtherDrawing = true;
m_sFileNameBeDeactivated = _T("\0");
es = acDocManager->activateDocument(pDocReActive); // reactivate previous drawing
}
}
}
}[/code] |
|