|
-
April 6th, 1999, 02:49 PM
#1
Writing in view from another dialog
I want to write into view window from a dialog (to present data for printer!)
I have simply created CDC object and used TextOut but it is not working.
How can I write into view window from another new dialog.
Please help
-
April 6th, 1999, 03:09 PM
#2
Re: Writing in view from another dialog
What I would try is use a sink approach to accomplish this. What if you had a class that was able to access the Main Frame or childframe depending on which way you go about it. You would have variables in that class that you would set from the dialog box class and you would have functions in the dialog box class that you can call that would take the information in the variables in the class and write that to the screen of the view.
-
April 6th, 1999, 03:57 PM
#3
Re: Writing in view from another dialog
I wrote a sample of what I was talking about in VC4.1. If you want it then send me an email and I will send it to you.
-
April 7th, 1999, 11:16 AM
#4
Re: Writing in view from another dialog
add th following to your dialog header:
#include "Your View.h"
class ..
{
public:
friend class CYourView;
CYourView *GetView();
..
};
#ifndef _DEBUG //
inline (CYourView* CYourDialog::GetView()
{ return (CYourView*)pView; }
#endif
add to your dialog-implementationfile(*.cpp):
#ifdef _DEBUG
CYourView *CBautagebuchDoc::GetView()
{
CMDIFrameWnd* pWnd = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd* pChild = (CMDIChildWnd*)pWnd->GetActiveFrame();
if(!pChild)
return NULL;
CView *pView = pChild->GetActiveView();
if(!pView)
return NULL;
POSITION pos = GetFirstViewPosition();
while (pos != NULL && !pView->IsKindOf(RUNTIME_CLASS(CYourView)))
{
pView = GetNextView(pos);
}
return (CYour*)pView;
}
#endif
______________________
now you can do the following in your Dialog Class:
CYourView *pView = getView();
pView->all_your_public_elements_and_functions
by the way: use SetWindowText instead of TextOut!!!
Rene´
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|