From: Ravnock on 16 Jul 2008 08:35 I have a CTreeCtrl and a 3D render view. With the mouse, I create elements picking in the 3D render view. This elements must be showed in the CTreeCtrl. What is the process to do it? I think 3D render view must send a message to the CTreeCtrl. CTreeCtrl captures it and update itself. But what kind of message and how?
From: Ajay Kalra on 16 Jul 2008 08:48 On Jul 16, 8:35 am, Ravnock <Ravn...(a)discussions.microsoft.com> wrote: > I have a CTreeCtrl and a 3D render view. > > With the mouse, I create elements picking in the 3D render view. This > elements must be showed in the CTreeCtrl. > > What is the process to do it? > > I think 3D render view must send a message to the CTreeCtrl. CTreeCtrl > captures it and update itself. > > But what kind of message and how? How are these two related? If you are using Doc/View and treectrl is one of the views, you should update the document and use UpdateAllViews. If these are not related, you will need to somehow access to CTreeCtrl in your 3D render view. That can be direct reference or thru some other object that you have access to. To insert data in treectrl, you will use InsertItem. Read up various methods available to the control here: http://msdn.microsoft.com/en-us/library/8bkz91b4(VS.80).aspx -- Ajay
From: David Wilkinson on 16 Jul 2008 08:53 Ravnock wrote: > I have a CTreeCtrl and a 3D render view. > > With the mouse, I create elements picking in the 3D render view. This > elements must be showed in the CTreeCtrl. > > What is the process to do it? > > I think 3D render view must send a message to the CTreeCtrl. CTreeCtrl > captures it and update itself. > > But what kind of message and how? Ravnock: All communication between views should be done with CDocument::UpdateAllViews(). -- David Wilkinson Visual C++ MVP
From: Ravnock on 16 Jul 2008 10:07 First of all, thanks to everybody for the help. I'm a newbie and I'm a bit lost. CClassView : public CMFCToolBar, the propetary of the CTreeCtrl object, is a member of the class CMainFrame : public CFrameWndEx To show in the CTreeCtrl the document data, CClassView must have a reference of the CDocument object or is there a better way? "Ravnock" wrote: > I have a CTreeCtrl and a 3D render view. > > With the mouse, I create elements picking in the 3D render view. This > elements must be showed in the CTreeCtrl. > > What is the process to do it? > > I think 3D render view must send a message to the CTreeCtrl. CTreeCtrl > captures it and update itself. > > But what kind of message and how?
From: David Wilkinson on 16 Jul 2008 10:27
Ravnock wrote: > First of all, thanks to everybody for the help. I'm a newbie and I'm a bit > lost. > > CClassView : public CMFCToolBar, the propetary of the CTreeCtrl object, is a > member of the > > class CMainFrame : public CFrameWndEx > > To show in the CTreeCtrl the document data, CClassView must have a reference > of the CDocument object or is there a better way? Ravnock: You should not refer to an object that is not derived from CView as a view, nor give it a name like CClassView. One (not very good OOP way) would be to do, in your 3D render view: CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd(); Now you can call any method on the main window, and have the main window update the tree view (which is the grand-child of the main window, if I am understanding you). A slightly better way (does not require casting) is to send a custom message to the main window, to accomplish the same purpose. CWnd::SendMessage() acts like a "universal virtual function" for any CWnd-derived class. -- David Wilkinson Visual C++ MVP |