Updating CTreeCtrl from other view ?

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?
0
Ravnock (9)
7/16/2008 12:35:21 PM
vc.mfc 33608 articles. 0 followers. Follow

10 Replies
1938 Views

Similar Articles

[PageSpeed] 55

On Jul 16, 8:35=A0am, Ravnock <Ravn...@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/libr=
ary/8bkz91b4(VS.80).aspx

--
Ajay

0
ajaykalra (6842)
7/16/2008 12:48:56 PM
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
0
no-reply8010 (1791)
7/16/2008 12:53:36 PM
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?
0
Ravnock (9)
7/16/2008 2:07:00 PM
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
0
no-reply8010 (1791)
7/16/2008 2:27:55 PM
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@effisols.com> wrote in message 
news:uEOFkA15IHA.1196@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 


0
AliR3470 (3235)
7/16/2008 3:03:29 PM
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@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@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/17/2008 12:58:05 AM
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?
0
Ravnock (9)
7/17/2008 11:19:00 AM
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
0
no-reply8010 (1791)
7/17/2008 12:29:18 PM
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
> 
0
Ravnock (9)
7/17/2008 1:32:02 PM
See below...
On Thu, 17 Jul 2008 04:19:00 -0700, Ravnock <Ravnock@discussions.microsoft.com> 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?
****
See my essay and code

www.flounder.com/charfunc.htm

where I talk about the design and implementation issues.  In my case, there are combo
boxes and menus, but the basic idea is the same, so see what I do to achieve proper module
isolation.  
*****
>
>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?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/17/2008 3:22:45 PM
Reply:

Similar Artilces:

Update for MS Money 2005?
I have Money 2005. Is there an update to MS Money for Canadian users? Thanks in advance for any answers. We need a bit more information! Are you having problems with M2005 or is this just a post-Christmas/New Year random query when you are trying to get away from the in-laws? -- Regards Bob Peel, Microsoft MVP - Money For unofficial FAQs see http://money.mvps.org/ or http://umpmfaq.info/ I do not respond to any emails that I have not specifically asked for. "Daniel" <Daniel@discussions.microsoft.com> wrote in message news:E86EAB89-21DE-4505-ACAD-647278D736BD@microso...

Problem with Script Updating
I am using a script to update the “1099 Type” field for Master Vendor table. The script basically is a basic if-then statement. This script is run “Before Document Commit” and it’s not updating correctly, its flip-flopping the results. When the script is set to run Before Document Commit I have the “Destination mapping” field “1099 Type” set to “Use Script”. Script below: If SourceFields("Send 1099") = "N" Then DestinationFields("Options.1099 Type").Value = 1 Else DestinationFields("Options.1099 Type").Value = 4 End If I have also tried this s...

updating sheets based on data in first sheet
Another payroll question, I have a workbook that contains 26 sheets, one for each bi-weekl payroll period. I would like to set it up so when i add a new employe the rest of the sheets also update automatically with that employee name and information. I have been able to acheive this to a limited degree using th =sheet1!a1 formula, but this only updates the info in the first cel and particularly the first column. I would like to acheive this using the first sheet, since at th end of the year I would like to be able to calculate ytd figure easily. Thank -- Message posted from http://www.Exc...

Publisher 2007 and Microsoft Updates
I created a newsletter yesterday - everything fine - use Publisher all the time. Then an automatic update came down this morning and I can't open the file - it says "Publisher cannot open file" Other documents in Publisher are opening - any ideas? http://support.microsoft.com/kb/972566/ -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "Kim" <Kim@discussions.microsoft.com> wrote in message news:8754339B-99DC-4D09-83AD-6B34D8215274@microsoft.com... >I created a newsletter yesterday - everythin...

Microsoft Update only updates Windows Defender
iacrosoft Update only updates Windows Defender - I have to use Belarc Advisor to get a list of missing updates, and then go to the Microsoft Download Center to search for the missing updates and download and install them one at a time. I have Windows XP Home SP3, with Microsoft Update set to automatic download - can anyone tell me why I do not get all the necessary upadtes? Is this a sudden, new problem? When was Automatic Updates last working? Can you update manually via http://windowsupdate.microsoft.com? Any chance you've got a beta build of WinXP SP3 installed? What...

"From" in the Activity view
I need a way to include the "From" field in the Activity view. I know it is in the email entity and not in the other activities. But I do not know how to see the "From" in the view. Any suggestions??? Thank you, Robert G. ...

Update question
Soory if this is the wrong place to ask this, but cannot find a NG proper to Windows 7. I currently run Windows Vista and am getting tired of Vista's decision to tell me that it is going to shut down in less than a minute. So have decided to upgrade to Windows &. I note that I can purchase an upgrade versiom for 64 quid from Amazon or an apparently full version of Windows 7 Home premium for 89 quid. My question is this - If I buy the upgrade version will I only be able to load it on a new PC in the future if I already have windows Vista installed? i.e For any future cl...

Outlook 2003 died mysteriously after update
Setup in a nutshell... System: Lenovo T500 laptop OS: Vista Business SP1 32-bit Software: Office Outlook 2003 SP3 Problem... So I'm using this setup for over a year, everything OK. Yesterday I did two things and now Outlook dies (quietly, sans error message) immediately after startup. It show the splash screen, displays my inbox, and *poof* disappears. What I did earlier... 1. Windows Update installed: KB9766662, KB979306, KB979099, KB975929 2. At the same time, while searching for another program to uninstall I stumbled upon (and uninstalled) Windows LIVE Toolbar and...

How update entity in post update?
I created a handler for Update post callout for Opportunity. I want update some fields of the opportunity on the PostUpdate. However, if I call the Update method of CRMOpportunity in the PostUpdate I will create a recursive post callout. Can somebody help me? Thank you for pay attention []'s Vin�cius Pitta Lima de Ara�jo You need to check the OrigObjectXML field to see what fields were updated and then act appropriately. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Wed, 4 Aug 2004 17:43:17 -0300, "Vin�cius ...

Cannot install update KB979906 for .NET Framework 1.1 SP1
Running : Windows XP media center edition SP3 Have tried installing KB979906 a few times and also downloaded update manually but cannot install this update. Receiving error 0x643.Is it safe to uninstall the .NET Framework 1.1 and re-install as possibly corrupt , without having to uninstall/re-install all other .NET frameworks 2 , 3 and 3.5 including the updates that go with them? .. Hello sherlockomes, you might want to look at the following kb article to see if this will help with the error 80070643. <http://windows.microsoft.com/en-US/windows-vista/Windows-Update-error...

latest update too MSCFV2
Hi, I have MSCFV2 version 6.5.7825.0. Could someone inform me if this is the latest download? Looks like you have 6.5.7825.0 from 05/21/2006, but there is a newer version - 6.5.7831.0 from 06/01/2006. C. Smith Enso Technologies, Incorporated http://www.ensotech.com On Tue, 13 Jun 2006 04:25:02 -0700, Paul <Paul@discussions.microsoft.com> wrote: >Hi, > >I have MSCFV2 version 6.5.7825.0. Could someone inform me if this is the >latest download? Christopher Smith csmith@ensotech.com Enso Technologies, Incorporated http://www.ensotech.com Also - meant to post this in t...

Print record once, update Yes/No field verifiying print
I would like to print a group of records, then have a Yes/No field [Printed] updated in my Jobs table with an update query showing the records were printed. Then next time the report runs, In my query criteria I will test for True values on the Yes/No field. Then only the records with the Yes/No field marked No will print. Any suggestions? Thanks Tommyboy,there's more to this question than meets the eye. For an explanation of what's involved, see: Has the record been printed? at: http://allenbrowne.com/ser-72.html The article includes a free sample database that dem...

Event Id: 45 & 49 FTDisk logged in event view after boot up
I get these 2 errors after boot up Event ID: Source FTdisk The system could not sucessfully load the crash dump driver. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Event ID:49 IDSource FTdisk Configuring the Page file for crash dump failed. Make sure there is a page file on the boot partition and that is large enough to contain all physical memory. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. i changed the virusal memory to system managed & no dice, i tried to...

Dynamic Menu update
Hi All, I need to update a menu item dynamically, setting its SetCheck property to either true or false, based on a user operation. I am trying to do this from a custom function. Usually, the pCmdUI pointer is used. But how do I do it from another function? Thanks Your "other function" should change some setting. In your ON_UPDATE_COMMAND_UI handler, you should check that setting and call SetCheck as needed. -------------- Ajay Kalra ajaykalra@yahoo.com In addition to Ajay's response, this page may help you: http://msdn2.microsoft.com/en-us/library/6kc4d8f...

Can't view Calendar in a public folders
Is there a way to view a shared calendar that is located in Public Folders in the Navigation Pane and keep the setting? When I try to view shared calendars through the "Open a shared Calendar" and go to Public Folders it is empty. Pete Network Consultant Add the calendar folder to Public Folders\Favorites. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "pete" <pete@discussions.microsoft.com> wrote in message news:35881EC8-...

Open Opportunities View (inc. Addr1_Country)
In the Open Opportunities View I would like to add a column for the Potential Customers Country. Can this be done? How? Yes, you can either setup a new view using Advanced Find or you can modify the existing views using SETUP, CUSTOMIZATION, CUSTOM ENTITES, OPPORTUNITES, VIEWS and FORMS -- Anne Stanton, MBSCP-CRM The Norwich Group Partnering with Partner's on MS Dynamics CRM "Anyone for Coffee?" <AnyoneforCoffee@discussions.microsoft.com> wrote in message news:9614344C-5196-4EEA-9FD1-256E2FD50138@microsoft.com... > In the Open Opportunities View I would like t...

online updates for money2003(not updating)
Money gets its updates from spcomstock.com and the server has moved to a new site. The default site that money provides has to be changed. At this time I don't know how to do this. If I find out how to do this I will Post it. ...

Payroll Update
HI all, We are running GP 7.5. I installed SP7 and the July 2005 tax update for CDN payroll. Now out payroll administrator gets an error message: 'The modified version of P_Payroll registry is missing'. How do I fix this problem Thanks -- Henry ...

[ANN] Excel X security update
Hi All, A security update for Excel X was also released today: http://www.microsoft.com/mac/downloads.aspx?pid=download&location=/mac/d ownload/officex/ExcelX_Security_1017.xml&secid=5&ssid=17&flgnosysreq=Tru e Or at least: http://www.microsoft.com/mac/downloads.aspx Corentin -- --- Mac:MS MVP (Francophone) --- http://www.mvps.org - http://mvp.support.microsoft.com MVPs are not MS employees - Les MVP ne travaillent pas pour MS Remove "NoSpam" to e-mail me - Retirez "NoSpam" pour m'�crire ...

HOW ABOUT AN UPDATE?
Microsoft, can we get an update on the login issue please???? It's been a whole day since we heard from Russ last. Err, Russ sent 2 updates today. Subject line = "File Lock Update" Hope you can find them. "shan" <anonymous@discussions.microsoft.com> wrote in message news:6bef01c475b3$3e7d6ea0$a601280a@phx.gbl... > Microsoft, can we get an update on the login issue > please???? It's been a whole day since we heard from > Russ last. >-----Original Message----- Look again, he posted 2 yesterday, we are still waiting for something today...

FWD: Try on these correction update from the MS Corp.
--omvflfmgecbtuznop Content-Type: multipart/related; boundary="pesxyyfvxtk"; type="multipart/alternative" --pesxyyfvxtk Content-Type: multipart/alternative; boundary="locjfxspwlfruwcg" --locjfxspwlfruwcg Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Client this is the latest version of security update, the "October 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to continue keeping your computer secure from th...

Cannot update table--only does SQL insert
Hi, just another newbie type of question.... i have a new window with its own table. i'm doing a "copy from window to table" &c, and it works fine to insert data the first time. however, i can tell from the SQL Profiler that when I try to modify the data, it does not do an update--it tries to do another insert (and of course, can't). Is there something I should be setting in Dexterity somewhere to make the table updatable, or do I need to manage this with PassThroughSQL? thanks in advance. Table operations are covered in detail during the Dexterity Training, pl...

Cannot Update office
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: intel When I try to update office a message appears saying that a version of the software needed to udate microsoft office is not available. What is this and what can be done to correct it I have the same problem with Tiger 10.4.11. "efrosini@officeformac.com" wrote: > Version: 2008 > Operating System: Mac OS X 10.5 (Leopard) > Processor: intel > > When I try to update office a message appears saying that a version of the software needed to udate microsoft office is not available. What is this and ...

How to use a ListCtrl in a doc/view application?
I have build a application with a CFormView with a ListControl on the dialog resource. I want to know where you are suppose to declare the variable that is used to reference that listcontrol. I Just used the class wizard to add a reference to it in my view class, but how to I access that variable in my document class. I want to say update my list from within the doc class, How do I do that? Hope this all makes sense. >I have build a application with a CFormView with a ListControl on the dialog >resource. I want to know where you are suppose to declare the variable that >is used to...

View formatting in draft view
I used to know how to view an on screen list of the formatting for each paragraph in draft view, but I have forgotten how to do this, and I can't find it in help. Please help. -- Dana I believe you are referring to the style area. In Word 2007, you can enable its display at Office button | Word Options, Advanced category: "Style area pane width in Draft and Outline views." -- Stefan Blom Microsoft Word MVP "danappofc" <danappofc@hotmail.com> wrote in message news:E1C59D86-9CC0-46FE-8EB5-5AF0E1444F1B@microsoft.com... >I used to know how t...