CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 1999
    Posts
    11

    Dialog Entry updating the view while still in dialog.

    I have a modal dialog up on a CView window. The window has data on it that as the user enters data in the dialog I want it to show in the main view window. I assume I could invalidate the main view but I can't seem to get the pWnd to that view window. I have sort of fixed the problem by exiting the dialog and re-entering it but that causes a flash that I do not like. How can I make the main view repaint when a modal dialog is up? Thanks!


  2. #2
    Join Date
    Aug 1999
    Posts
    11

    Re: Dialog Entry updating the view while still in dialog.

    Hi,

    Do a EnableWindow(TRUE) then InvalidateRect(NULL) and EndbleWindow(FALSE).

    Hope it helps...
    Viswanathan



  3. #3
    Join Date
    Sep 1999
    Location
    California, USA
    Posts
    37

    Re: Dialog Entry updating the view while still in dialog.

    There is a number of ways to access a view from your dialog. One is to have a dialog member of the view type and assign 'this' pointer to it on dialog creation (in constructor) or before you call DoModal from your view class. You can access the view from the dialog simply by using this member. Another way would be to use function to access active frame from which you can get the active view. For MDI app, it would look similar to (CMyView*)((CMDIFrameWnd*)AfxGetApp()->m_pMainWnd)->MDIGetActive()->GetActiveView(). You have to split this into different steps and validate result of each call. I usually use the third approach, which is to add a static member function GetView to the view class allowing to access this view from anywhere in the program. See Microsoft Knowledge Base article Q108587 for details (http://support.microsoft.com/support.../Q108/5/87.asp).


  4. #4
    Join Date
    Sep 1999
    Posts
    11

    Re: Dialog Entry updating the view while still in dialog.

    Thank You!

    I had already tried the first approach which works great, but your third approach really looks better. I want to study you second idea just to understand it. Thanks again!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured