Click to See Complete Forum and Search --> : Dialog Entry updating the view while still in dialog.
GilFisher
September 30th, 1999, 10:30 AM
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!
S Viswanathan
September 30th, 1999, 11:36 AM
Hi,
Do a EnableWindow(TRUE) then InvalidateRect(NULL) and EndbleWindow(FALSE).
Hope it helps...
Viswanathan
bandukoa
September 30th, 1999, 11:55 AM
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/kb/articles/Q108/5/87.asp).
GilFisher
September 30th, 1999, 03:11 PM
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!
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.