Problem using MFC modal dialog with long animation refresh 
Author Message
 Problem using MFC modal dialog with long animation refresh

Hi,

I'm using OpenGL, a SetTimer call and OnTimer method to control an
animation in a MFC MDI program.  It all seems to work great until the
size of the models I am displaying cause the refresh rate to exceed
the interval between the OnTimer calls.  I don't mind if the animation
slows down at that point (which it does) since this is an engineering
application.  The problem is that when I try to bring up a modal
window with a CDialog::DoModal() call while it is animating, the
dialog never appears but the dialog handler thread continues to
execute and wait for input.  My animation contiues to run but I can no
longer get the focus back from the dialog and can't interact with the
UI.

I suspect the problem is that my OnTimer routine issues redraw events
rather than actually redrawing the program.  If this is the case, can
someone suggest a better way to handle the animation timing in a MDI
program where all of the views and models animate together?

Here is some of my code:

void CMainFrame::OnTimer(UINT nIDEvent)
{ CObList docList;
  CNomadDoc *doc;
  POSITION pos;

  theApp.GetDocumentList(&docList);
  if (!docList.IsEmpty())
  {
    doc=(CNomadDoc *)docList.GetHead();
    pos=docList.GetHeadPosition();
    while(pos)
    {
      doc->AdvanceOneFrame(m_viewDialog.m_fAmplitude,
                      DEFAULT_FPS/m_viewDialog.m_fPrefOscilationTime);
      doc->UpdateAllViews(NULL);
      doc=(CNomadDoc *)docList.GetNext(pos);
    }
  }
  CMDIFrameWnd::OnTimer(nIDEvent);

Quote:
}

// this routine is called from the user menu
void CMainFrame::OnViewOptions()
{ int createVal;

  createVal=m_viewDialog.DoModal();  // hangs in this call
  if(createVal==IDOK)
  {
    renderSettings.bAntialiasing=m_viewDialog.m_bLineSmoothing;
    renderSettings.m_fLineWidth=m_viewDialog.m_fLineWidth;
    CNomadDoc *doc=(CNomadDoc *)GetMDIActiveDocument();
    if (doc!=NULL)
      doc->UpdateAllViews(NULL);    
  }

Quote:
}



Mon, 28 Jun 2004 03:31:09 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Non MFC modal dialogs in an MFC application - Dialog Message problem

2. Dialog refresh problem using Automation

3. modal dialogs on top of modal dialogs...

4. Showing a modal dialog in a modal dialog application

5. modal dialog spawning a modal dialog

6. Modal dialog over a modal dialog ( How to...?)

7. Howto simulate a modal dialog using CWindow ?

8. Modal CDialogImpl dialogs and MFC apps

9. Problem using delete with dialog-based MFC app

10. MFC Modal Dialog from in-process com-server dll

11. creating Modal vs. Non-Modal dialogs

12. problem with using MFC modeless dialog and WSH+JScript

 

 
Powered by phpBB® Forum Software