Question about refresh CTreeCtrl in my CFormView

I create a SDI project.At Step6 I change CView to CFormView.After then I add a CTreeCtrl in my frame for display some data ,and I add some dialog .Now I have a question: when I click menu create the dialog and then click OK return to the Frame,I want to refresh the data in CTreeCtrl,but I don't know how ?
Help me
:(
[332 byte] By [rainhard] at [2007-11-18 3:48:39]
# 1 Re: Question about refresh CTreeCtrl in my CFormView
Something does not add up.
- Do you change CView to CFormView in a project or changing views at the runtime?
- Are you adding tree control to that view or to a frame?
- What dialog do you create?
JohnCz at 2007-11-11 3:39:35 >
# 2 Re: Question about refresh CTreeCtrl in my CFormView
First Thank you very much!

- Do you change CView to CFormView in a project or changing views at the runtime?

I don't understand this.I said I just change the CView to CFormView in the Wizerd step 6.

- Are you adding tree control to that view or to a frame?
I think I add it to the view .What I add to is IDD_FORM

- What dialog do you create?
I create some dialog to add or delete data the tree contain,but I don't know when I have done these how to refresh the tree ctrl.

Thanks !
rainhard at 2007-11-11 3:40:35 >
# 3 Re: Question about refresh CTreeCtrl in my CFormView
I think I understand what you are doing now (I overlooked App Wizard step 6).

Now the only question remains: where are you invoking a dialog from (view, main frame . . .).
JohnCz at 2007-11-11 3:41:41 >
# 4 Re: Question about refresh CTreeCtrl in my CFormView
I click one menu item to invoke a dialog
maybe is from frame
rainhard at 2007-11-11 3:42:46 >
# 5 Re: Question about refresh CTreeCtrl in my CFormView
Originally posted by rainhard
maybe is from frame You should know where are you handling menu message.

I am assuming that you handle menu invoking dialog in a main frame window.

Here is a sample code.

void CMainFrame::OnViewDialog()
{
CTestDlg dlg;
if(IDOK == dlg.DoModal())
{
//this will get view and return NULL pointer if view is not CFormTreeTestView
CFormTreeTestView* pView = DYNAMIC_DOWNCAST(CFormTreeTestView, GetActiveView());

ASSERT(pView); // if pointer NULL this will fire

//use pView->m_Tree to do whatever you need
pView->m_Tree.InsertItem("New Root Item");
}

}
JohnCz at 2007-11-11 3:43:45 >
# 6 Re: Question about refresh CTreeCtrl in my CFormView
CFormTreeTestView* pView = DYNAMIC_DOWNCAST(CFormTreeTestView, GetActiveView());

ASSERT(pView); // if pointer NULL this will fire

Thank you very much !
I try this ,then done .
Now I know how to .
Thanks & Best regards!
rainhard at 2007-11-11 3:44:43 >
# 7 Re: Question about refresh CTreeCtrl in my CFormView
You are welcome.
JohnCz at 2007-11-11 3:45:47 >