Communication between Views

Hello. I have a few questions regarding User-Defined messages in MFC

I have an SDI application with a CEditView and a second view using MFC
Grid Control v2.25 (From The Code Project). What I want to code is a
means for the grid view and CEditView to communicate. When the grid
view is clicked on a particular column (which contains data from the
document), I want to send a message that is received by the CEditView,
which then displays information from the document.

Is subclassing the best way to solve this problem? I currently have the
compiler responding to clicks in the grid view (as evidenced by the
debug information), but I can't get the breakpoint in the CEditView
class to trigger.

Also: Can I use the infrequently-documented WPARAM and LPARAM to pass
row and column information for my user-defined message?

I am very much a novice, so any help would be greatly appreciated.

0
birdinhand (24)
8/15/2005 11:33:57 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
552 Views

Similar Articles

[PageSpeed] 45

You can store the information in the document, make an OnUpdate() handler 
for each view, and just call the UpdateAllViews() routine in the document 
class which will call each view.  You can even pass hints to it to tell each 
view specific instructions.

Tom

"Drowzee" <birdinhand@gmail.com> wrote in message 
news:1124148837.868909.93440@g14g2000cwa.googlegroups.com...
> Hello. I have a few questions regarding User-Defined messages in MFC
>
> I have an SDI application with a CEditView and a second view using MFC
> Grid Control v2.25 (From The Code Project). What I want to code is a
> means for the grid view and CEditView to communicate. When the grid
> view is clicked on a particular column (which contains data from the
> document), I want to send a message that is received by the CEditView,
> which then displays information from the document.
>
> Is subclassing the best way to solve this problem? I currently have the
> compiler responding to clicks in the grid view (as evidenced by the
> debug information), but I can't get the breakpoint in the CEditView
> class to trigger.
>
> Also: Can I use the infrequently-documented WPARAM and LPARAM to pass
> row and column information for my user-defined message?
>
> I am very much a novice, so any help would be greatly appreciated.
> 


0
tserface (3860)
8/15/2005 11:40:13 PM
Tom's suggestion is the simplest method.  I use it all the time for multiple view
communication.  

If you are using user-defined messages and not getting the breakpoing, you need to check
to see that you are sending the message to the right window, and that you have the correct
entry in your MESSAGE_MAP.  If it is a Registered Window Message make sure that you have
registered it properly in both views.  But I'd be inclined, if I found code like this in
an app, to replace it with something that used UpdateAllViews as already suggested.
					joe

On Mon, 15 Aug 2005 16:40:13 -0700, "Tom Serface" <tserface@msn.com> wrote:

>You can store the information in the document, make an OnUpdate() handler 
>for each view, and just call the UpdateAllViews() routine in the document 
>class which will call each view.  You can even pass hints to it to tell each 
>view specific instructions.
>
>Tom
>
>"Drowzee" <birdinhand@gmail.com> wrote in message 
>news:1124148837.868909.93440@g14g2000cwa.googlegroups.com...
>> Hello. I have a few questions regarding User-Defined messages in MFC
>>
>> I have an SDI application with a CEditView and a second view using MFC
>> Grid Control v2.25 (From The Code Project). What I want to code is a
>> means for the grid view and CEditView to communicate. When the grid
>> view is clicked on a particular column (which contains data from the
>> document), I want to send a message that is received by the CEditView,
>> which then displays information from the document.
>>
>> Is subclassing the best way to solve this problem? I currently have the
>> compiler responding to clicks in the grid view (as evidenced by the
>> debug information), but I can't get the breakpoint in the CEditView
>> class to trigger.
>>
>> Also: Can I use the infrequently-documented WPARAM and LPARAM to pass
>> row and column information for my user-defined message?
>>
>> I am very much a novice, so any help would be greatly appreciated.
>> 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
8/16/2005 3:06:42 PM
Thank you. That seems simpler, and helps me avoid some #include
foolishness.

So, to give these 'hints', I can use enum'd values (for clarity) in
UpdateAllViews() and switch statements in the OnUpdate() for each view,
correct?

Does UpdateAllViews(Lparam) automatically insert a pointer to the
modified CObject?

For example, if I'm using a data class encapsulating only data
elements, (not inheiriting from CObject, but that can be changed if
necessary), and I'm using multiple instances of this dataclass in a
vector, would I automatically get a pointer to the instance of CObject
that was modified, to the vector, or would I have to specify that
pointer somehow [as I may not know the selection's location on the
screen, ergo, if the first or second column was clicked] ?

Thank you for your time and assistance..

I know that my question is rather ambiguous, but I am

0
birdinhand (24)
8/16/2005 8:05:21 PM
If both views have the same document, then UpdateAllViews is the best. Like
Joe and Tom said before.
But if they don't :
I do have this handy little class which helps with sending message from one
view to another, by not having to know the different view hwnd. ;)

http://www.codeproject.com/docview/Broadcaster.asp

AliR.

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:j304g11gm2p4ta1p7fs0mvip5fqc4m6sd6@4ax.com...
> Tom's suggestion is the simplest method.  I use it all the time for
multiple view
> communication.
>
> If you are using user-defined messages and not getting the breakpoing, you
need to check
> to see that you are sending the message to the right window, and that you
have the correct
> entry in your MESSAGE_MAP.  If it is a Registered Window Message make sure
that you have
> registered it properly in both views.  But I'd be inclined, if I found
code like this in
> an app, to replace it with something that used UpdateAllViews as already
suggested.
> joe
>
> On Mon, 15 Aug 2005 16:40:13 -0700, "Tom Serface" <tserface@msn.com>
wrote:
>
> >You can store the information in the document, make an OnUpdate() handler
> >for each view, and just call the UpdateAllViews() routine in the document
> >class which will call each view.  You can even pass hints to it to tell
each
> >view specific instructions.
> >
> >Tom
> >
> >"Drowzee" <birdinhand@gmail.com> wrote in message
> >news:1124148837.868909.93440@g14g2000cwa.googlegroups.com...
> >> Hello. I have a few questions regarding User-Defined messages in MFC
> >>
> >> I have an SDI application with a CEditView and a second view using MFC
> >> Grid Control v2.25 (From The Code Project). What I want to code is a
> >> means for the grid view and CEditView to communicate. When the grid
> >> view is clicked on a particular column (which contains data from the
> >> document), I want to send a message that is received by the CEditView,
> >> which then displays information from the document.
> >>
> >> Is subclassing the best way to solve this problem? I currently have the
> >> compiler responding to clicks in the grid view (as evidenced by the
> >> debug information), but I can't get the breakpoint in the CEditView
> >> class to trigger.
> >>
> >> Also: Can I use the infrequently-documented WPARAM and LPARAM to pass
> >> row and column information for my user-defined message?
> >>
> >> I am very much a novice, so any help would be greatly appreciated.
> >>
> >
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>


0
AliR3470 (3235)
8/16/2005 9:08:26 PM
There is no "automatic pointer" to anything.  If you want a pointer passed, you must pass
it as the pHint value (it doesn't need to be a CObject *; that is an historical accident
and it should have been a PVOID, had anyone been paying attention).  Anything you want to
pass across you have to pass across yourself (think about it...how would a general
mechanism have a clue as to what your vector looked like, or even if it existed...?)
				joe

On 16 Aug 2005 13:05:21 -0700, "Drowzee" <birdinhand@gmail.com> wrote:

>Thank you. That seems simpler, and helps me avoid some #include
>foolishness.
>
>So, to give these 'hints', I can use enum'd values (for clarity) in
>UpdateAllViews() and switch statements in the OnUpdate() for each view,
>correct?
>
>Does UpdateAllViews(Lparam) automatically insert a pointer to the
>modified CObject?
>
>For example, if I'm using a data class encapsulating only data
>elements, (not inheiriting from CObject, but that can be changed if
>necessary), and I'm using multiple instances of this dataclass in a
>vector, would I automatically get a pointer to the instance of CObject
>that was modified, to the vector, or would I have to specify that
>pointer somehow [as I may not know the selection's location on the
>screen, ergo, if the first or second column was clicked] ?
>
>Thank you for your time and assistance..
>
>I know that my question is rather ambiguous, but I am
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
8/18/2005 4:05:45 AM
Reply:

Similar Artilces:

view, task pane
How do i get the view, task pane to auto-load each time i start excel? TOOLS > OPTIONS > VIEW - Startup Task Pane Tick/Untick >-----Original Message----- >How do i get the view, task pane to auto-load each time i >start excel? >. > Tools, Options, click the View tab and under "Show", click Startup Taskpane. Judy Freed Systems Development UNC Charlotte "warnimont" <anonymous@discussions.microsoft.com> wrote in message news:22f6601c45de4$08378740$a501280a@phx.gbl... > How do i get the view, task pane to auto-load each time i > start exce...

Excel View
When I am using Excel I can not see my fill colors in Normal View. I can hit print preview and see the fill colors and the doc will print correctly, however I would like to see my fill colors as I am creating my spreadsheet. How do I get the program to do this? Check this out................ http://support.microsoft.com/default.aspx?kbid=833258 The fill color, the fill pattern, or the line color of a WordArt or AutoShape object in an Office document does not change As directed, change the High Contrast setting in Windows OS for users' profiles. Gord Dibben MS Exce...

How do I set a view as default for entire folder hierarchy?
I do not like the grid line and general layout of Outlook 2003's standard view. I can see how to switch off the lines and get the view I like but despite redefining a view using : VIEW > ARRANGE BY > CURRENT VIEW > DEFINE VIEWS I can't see any item in the list that will define a new 'standard view' for all of my other 200 or so folders. It's crazy to set each folder to my preferred view one-by-one. How do I set a new default view? ...

How to realize communication problem?
Hello everybody. I am working on a project in which I read/write data via rs-232 from/to my Windows application to/from an microcontroller. Now, my boss wants me to write a library which he can use for different microcontrollers. This library should store any changes of data. So the desired microcontroller should just be able to pick up the data. You can think of it this way: Me, representing the Windows application, put a sheet of information into a drawer. A buddy of mine, (representing a microcontroller) can go to the drawer an pick up the sheet for further treatment. So, my quest...

Slow or no communication at all
Hello all. Since I'm new around here, please let me know if this is the right place to post this. I've been checking these forums for a long time now, but fortunately I always found what I was looking for and never had the need to post. For that, I want to thank you all for the tremendous work (and help) everyone participating here have been given throughout these years. The problem that brings me here today, relates not entirely to the SBS 2003. What happens is that we have several MAC OS machines connecting to several shares in a SBS 2003. Everything was ok untill one o...

Setting a view for multiple folders in one step?
Is it possible to select a certain view to several folders at once? How could I easily choose "messages with autopreview" for instance to more than one folder at a time? (Is this impossible?) thanks Sabrina ...

View of All Folders
Is there a way to establish a view that displays the contents of all folders in Outlook 2007? No. --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. =20 After furious head scratching, Cindy Mikeworth asked: | Is there a way to establish a view that displays the contents of all | folders in Outlook 2007? ...

Some graphic do not show up while viewing
While I'm working on my newsletter some of my graphics do not show up. The picture box is there but it only shows up when I go to print preview. This makes it hard to edit not being able to see the graphic. Any suggestions? View, pictures, detailed display -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "barryll" <barryll@comcast.net> wrote in message news:O7pgDO1FFHA.1260@TK2MSFTNGP12.phx.gbl... > While I'm working on my newsletter some of my graphics do not show up. The picture > box is there but it...

switch view to Tasks pane
Hey all. Can someone post a script that will switch an already running instance of outlook from the folder that is being displayed to the Tasks folder? Outlook version 11 is what I am running. -thanks Outlook VBA code: Sub SwitchToTasks() Set tasks =3D Application.Session.GetDefaultFolder(olFolderTasks) Set Application.ActiveExplorer.CurrentFolder =3D tasks End Sub FYI, there is a newsgroup specifically for general Outlook programming = issues "down the hall" at microsoft.public.outlook.program_vba or, via = web interface, at = http://www.microsoft.com/office/community/en...

How to communicate between threads?
Hi, there I used "AfxBeginThread()" to run a background working thread, while keeping the displaying thread. Because I got many file names in working thread, I want to show them in the displaying thread. How to get those CStringArray pointer from working thread? Thanks Gary On Tue, 13 Apr 2004 09:31:07 -0700, "Gary" <anonymous@discussions.microsoft.com> wrote: >Hi, there, > >I used "AfxBeginThread()" to run a background working thread, while keeping the displaying thread. Because I got many file names in working thread, I want to show them i...

Custom View of worksheet in different workbook
Hi All, I have a question about excel 2000. Situation: Now, i have 3 workbooks, say Q1_Sales, Q2_Sales, Q3_Sales and in each workbook, there are 3 worksheets, say Product_A, Product_B, Product_C. So, my question is: is there any way (apart from copy worksheet one by one) that i can view all Product_B sheets in one workbook ? ie, one workbook (it's like a summary workbook) contains all product_b worksheets only. any excel function that can do that? or it can only be done by macro ?? any idea will be appreciate. Thanks for your time. Hi! You can link to the data in a summary workboo...

Inline picture viewing
Is it possible to view pictures attached to an email as an inline display? I.e. within the mail, similar to outlook express can the picture just be displayed? On Sun, 5 Sep 2004 13:38:47 -0700, "Mark" <anonymous@discussions.microsoft.com> wrote: >Is it possible to view pictures attached to an email as an >inline display? I.e. within the mail, similar to outlook >express can the picture just be displayed? No. -- <<<SgtRich>>> Email Client: Microsoft Office Outlook 2003 News Client (Text): Fort� Agent 2.0 www.forteinc.com News Client (Binarie...

URGENT: Outlook 2003 / Exchange 2003 SP1 communication ports.
Hi, If anyone could help me with this I would be more than grateful. We have moved our Exchange Server to a DMZ with public address space, we are trying to connect Outlook 2003 clients to the server from our private address space. The routing is all set up correctly as we can ping both ways which leads me to believe it's a port problem, i.e. I haven't opened enough up. I've searched TechNet for the relevant documents and have made the needed changes where necessary. I have set a high static port in the registry on the exchange server and our domain controllers for RPC AD re...

Communicating
Hello! I am writning a program that will communicate with a server (Linux) using RS232 or TCP/IP. The server is using the same protocol for both. The protocol is rather 'chatty', so for each command there is a lot of sending and receiving. I have created a test program for the RS232 communication using blocking. It works but the program freezes until the communication is done... So I thinking about using some kind of event driven way. I have looked at Mr. Ramon de Klein's serial classes, and they look very good http://www.codeproject.com/system/serial.asp However I need t...

Firewire communication
Hi guys, I am trying to interact with a camera through firewire. I wrote a code based on the example given in MSDN. When I execute the code it always return the value 1 no matter whether the device is connected or disconnected. Please let me know what went wrong, i couldnt figure out the problem so for. My code is as follows. -------------------------------------- void CFireDlg::OnDeviceNotify() { // TODO: Add your control notification handler code here CString cs; bool bDevInterResult=FALSE; HDEVNOTIFY *hdn=NULL; bDevInterResult = DoRegisterDeviceInterface(GUID_MP1394MI,...

Outlook 2007 messages view in text when they should be in html
One of my users who is running Office 2007 has recently experienced email messages in Outlook coming in as text (only) when they should be in HTML. Her settings for outgoing messages are for HTML. Others are using Office 2003 with Outlook 2007 and have not experienced the same problem. Any ideas? are you sure the sender is using HTML when they compose the message? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ Outlook Tips by email:...

Buttons and View Names
How does one go about changing the labels on the navigation buttons, Go To listing, and action views (ie. I want to change Leads to Prospects or Sales Literature to Marketing)? Joe You can't. Really, the only way is to include JS in the mscrm files, and parse the menus at runtime. Mike "Joe" <anonymous@discussions.microsoft.com> wrote in message news:447f01c3e45a$81ec4340$a301280a@phx.gbl... > How does one go about changing the labels on the > navigation buttons, Go To listing, and action views (ie. > I want to change Leads to Prospects or Sales Literature...

Customizing Views
I would like to add fields to a view.How do I do this?? -- Cheers Art In CRM 1.2 go to Home Page > Settings > System Customization and click on the object for which you would like to modify views, such as Contacts or Accounts. In the customization screen, on the bottom right will be a list of the views. You can double-click a view to open the screen to edit it. There will be buttons on the right which let you add or remove columns. -- Matt Wittemann http://icu-mscrm.blogspot.com "ART@CT" wrote: > I would like to add fields to a view.How do I do this?? > -- >...

Excel communicating to csharp application
In Excel I need some information that the csharp application holds. What would be the best aproach for this problem. Any help is really appreciated. THANKS ...

How do I view everything that is part of a Publisher publication?
I am trying to work with a Publisher document that someone else created and I would like to be able to view all of the graphics, images, and fonts all at the same time, within the program to make sure that it still looks correct even when I edit things. Please let me know how I am supposed to go about doing this as I have spent over an hour trying to figure it out and can't seem to get it all to appear on the page as it will look when printed out. On Mon, 27 Mar 2006 19:19:02 +0100, Lizz wrote (in article <AD6D87F4-4428-452A-98D8-E4EADE3617CA@microsoft.com>): > I am trying...

Changing Current View in Multiple subfolders
I am unable to figure out how to change the "Current View" of multiple subfolders without going into each individual subfolder. Basically I would like to only have to change the view once for multiple folders. I did try changing the Current View on the Main folder but that did not affect the subfolders. You can't get around doing each one, BUT you can "Define" a view, and Apply it to them with a tick in Current View. Angus wrote: > I am unable to figure out how to change the "Current View" of multiple > subfolders without going into...

communication
My client needs to communicate between two computers. Is there anyway they can share calendars without a server. I think I know the answer and its nuts. The work arounds I have tried do not work efficiently. Can someone steer me in the right direction? I need to share calendars and winfax pro files ? Thanks Take a look here, it may help: http://www.slipstick.com/outlook/share.htm --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without r...

How to view file and folder permissions
Hi All, We're using SharePoint 2007 and people have started setting file and folder level permissions. Question - Is there some way to view the permissions set on all the files and folders, like in a Designer Report, or setting meta data? Is there an easy way, without looking at the permissions on each file and folder to see what files and folders have stopped inheriting permissions from the library and now have unique permissions? There has to be some way to get this information, I just can't find it. Thanks. -- Jane You'll need some third party add-on so...

Handling Thread communications
I have 2 threads used for serial communications (receive and transmit). I've wrestled with a couple of issues off and on for long time. 1. I currently use a ring buffer for the receive thread to put data in. When data is received, the thread uses PostMessage() to send a message to the application to process the data. This works for the most part except now I have encountered a problem when I display a MessageBox() while processing received data; I get more messages from the thread that seem to interfere with the process. ie the MessageBox displays twice for some reason. When I chang...

Viewing Worksheets withing One Workbook
My PC Excel (2002) allows me to have many worksheets within one workbook. I can see the tabs at the bottom of the workbook to access each sheet. Does it work the same in the Mac 2004 Excel? The MAC person I am sending my PC workbook to says he can only see one worksheet when there should be four. He doesn't see any tabs at the bottom showing the different sheet names. What can I have him look for to find these sheets? Thanks once again :) No Tabs can be seen? In Excel for Windows you would go to Tools>Options>View> and checkmark "Sheet Tabs" or hit CTRL + P...