From: AliR (VC++ MVP) on
He can also use this class to send a message directly to the "CClassView".

http://www.codeproject.com/KB/docview/Broadcaster.aspx

AliR.



"David Wilkinson" <no-reply(a)effisols.com> wrote in message
news:uEOFkA15IHA.1196(a)TK2MSFTNGP05.phx.gbl...
> 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


From: Joseph M. Newcomer on
No. In fact, read my essay on my character function code. The CTreeCtrl would definitely
NOT have any access to the document! What I would do is have the document do
UpdateAllViews, and have the view take responsibility for sending a message to the toolbar
to update itself, and the toolbar would use the information in that message to do the
update.
joe

On Wed, 16 Jul 2008 07:07:00 -0700, Ravnock <Ravnock(a)discussions.microsoft.com> 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" 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?
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Ravnock on
I understood the updating mechanism between views and controls in the view
->direction direction.

But in the inverse case:

I have my CPropertiesWnd class child of CDockablePane, with a reference to a
CMFCPropertyGridCtrl. (Like the wizard example).

In the CMainFrame class (child of CFrameWndEx) I have a reference to
CPropertiesWnd.

I change a property value in the property window.

What I must do?

What are the classes involved and how?

Thanks for all

"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
Ravnock wrote:
> I understood the updating mechanism between views and controls in the view
> ->direction direction.
>
> But in the inverse case:
>
> I have my CPropertiesWnd class child of CDockablePane, with a reference to a
> CMFCPropertyGridCtrl. (Like the wizard example).
>
> In the CMainFrame class (child of CFrameWndEx) I have a reference to
> CPropertiesWnd.
>
> I change a property value in the property window.
>
> What I must do?
>
> What are the classes involved and how?

Ravnock:

I am not familiar with the new Feature Pack, so I'm not sure I can really help
you, but as a point of nomenclature you should not use the word "child" when you
mean "sub-class". The parent-child relationship in Windows has nothing whatever
to do with the C++ class system.

The way controls normally work is that they send messages to their parent. In
some cases, e.g. CDialogBar, MFC re-routes these messages to its parent (the
grand-parent of the control).

--
David Wilkinson
Visual C++ MVP
From: Ravnock on
Sorry for my expressions, almost it's due to my poor english.

Really, I get the control message in the control parent. At first I didn't
know which were the correct ID and map declaration to get when a property
were changed. Finally I discovered it:

ON_REGISTERED_MESSAGE(AFX_WM_PROPERTY_CHANGED, OnPropertyChanged)

And the member function declaration is the following:

LRESULT CPropertiesWnd::OnPropertyChanged( WPARAM wparam, LPARAM lparam){
....
}


"David Wilkinson" wrote:

> Ravnock wrote:
> > I understood the updating mechanism between views and controls in the view
> > ->direction direction.
> >
> > But in the inverse case:
> >
> > I have my CPropertiesWnd class child of CDockablePane, with a reference to a
> > CMFCPropertyGridCtrl. (Like the wizard example).
> >
> > In the CMainFrame class (child of CFrameWndEx) I have a reference to
> > CPropertiesWnd.
> >
> > I change a property value in the property window.
> >
> > What I must do?
> >
> > What are the classes involved and how?
>
> Ravnock:
>
> I am not familiar with the new Feature Pack, so I'm not sure I can really help
> you, but as a point of nomenclature you should not use the word "child" when you
> mean "sub-class". The parent-child relationship in Windows has nothing whatever
> to do with the C++ class system.
>
> The way controls normally work is that they send messages to their parent. In
> some cases, e.g. CDialogBar, MFC re-routes these messages to its parent (the
> grand-parent of the control).
>
> --
> David Wilkinson
> Visual C++ MVP
>
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: CMFCOutlookBar
Next: Overriding the CDateTimeCtrl class.