Link to home
Start Free TrialLog in
Avatar of Edy1988
Edy1988

asked on

document with dialogs

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
ASKER CERTIFIED SOLUTION
Avatar of GlennDean
GlennDean

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Edy1988
Edy1988

ASKER

But the GetActiveDocument is a FrameWnd method, how can i use it from the view?
Hi Edy1988:
   Call the View's GetDocument function.
   Glenn
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.
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 ...
Avatar of Edy1988

ASKER

degarn!
Had you posted your answer as answer and not as comment,i might have given you the points
Eyal
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...
>>to the same answer I gave !
Sorry...