Solved

document with dialogs

Posted on 2000-04-16
8
159 Views
Last Modified: 2013-11-20
I have dialogbox in the view(dial1), now dial1 calls another dialogbox(dial2)
I want that this dialogboxes will update the Document's variable(not hte view's variable).
How do i do it?
Eyal
0
Comment
Question by:Edy1988
  • 4
  • 2
  • 2
8 Comments
 
LVL 3

Accepted Solution

by:
GlennDean earned 50 total points
ID: 2720490
Hi:
   Have your dialog have a member variable say
  CMyDoc * pDoc;
Before your view creates the dialog, call it myDlg, write
CMyDoc * pDoc = (CMyDoc *)GetActiveDocument();
myDlg.pDoc=pDoc;
//Spin the dialog up, say via DoModal

Then, in the dialog, it has access to the document's variables.
   Glenn
0
 

Author Comment

by:Edy1988
ID: 2721540
But the GetActiveDocument is a FrameWnd method, how can i use it from the view?
0
 
LVL 3

Expert Comment

by:GlennDean
ID: 2723303
Hi Edy1988:
   Call the View's GetDocument function.
   Glenn
0
 

Expert Comment

by:degarn
ID: 2723373
The view has also a specific member function which links it to its related view :
CDocument* GetDocument();

Well, now, if your document is specialized, I mean if you've added specific member variables in it that you want to acces from your dialogs, you 've got to ways to process :

1) Use casting :
dial1 aDlg;
CMyappDoc* pDoc=(CMyAppDoc*)pmyAppView->GetDocument();
aDlg.m_pDoc=pDoc; //where m_pDoc is declared CMyAppDoc* m_pDoc in dial1

2) Create a member function in your view :
CMyAppDoc* CMyAppView::GetMyAppDoc()
{
       return (CMyAppDoc*)GetDocument();
}

And then use the same member variable in your dialog that was offered by GlennDean :
//Place this code in your view
dial1 aDlg;
aDlg.m_pDoc=GetMyAppDoc();

Btw, a good thing would be to override your dialog's constructor to give them the doc pointer :

dial1 aDlg(GetMyAppDoc());

Hope this help...
Arn.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:degarn
ID: 2725654
Well, my comment seems upset now, but i promess when I began to write it, GlennDean's comment wasn't added yet !
I'll be faster the next time ...
0
 

Author Comment

by:Edy1988
ID: 2725683
degarn!
Had you posted your answer as answer and not as comment,i might have given you the points
Eyal
0
 

Expert Comment

by:degarn
ID: 2725955
Hi Edy,
when a question was answered once, it's placed in the list of locked questions that had received answers and have to be evaluated by asker. Then it's impossible to give it another answer till the asker accepts or rejects the proposed answer. When you answer a question in that list, you can only post comments and so you take the risk not receiving the related points.
Btw, I'm sure GlennDean would finally have arrived to the same answer a gave !
Well, I'm happy my answer was useful...
0
 

Expert Comment

by:degarn
ID: 2725960
>>to the same answer I gave !
Sorry...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Powershell based monitoring system 2 127
has77  challenge 9 68
mapBully challenge 6 89
Sed question 2 48
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now