Communication among Components
-
I'm working on a personal project using MFC. I'm still a beginner with it, however One thing that I'm having problems with is trying to figure out how to communicate between the different components of my application. I have a Main Frame window with the Report Control View (http://www.codeproject.com/miscctrl/reportctrl.asp), a toolbar, and a menu. Now, what I would like to do is allow the user to delete/edit entries in the view using the keyboard (catching windows messages for the view) and also using the toolbar and menu on the main window. How can I communicate with the view through the main window class? I'm finding it confusing trying to figure out the message maps for both view and frame. I'm sure it will fall together when I get other peoples' ideas. I hope my description wasn't too confusing :) Any help will be appreciated.
-
I'm working on a personal project using MFC. I'm still a beginner with it, however One thing that I'm having problems with is trying to figure out how to communicate between the different components of my application. I have a Main Frame window with the Report Control View (http://www.codeproject.com/miscctrl/reportctrl.asp), a toolbar, and a menu. Now, what I would like to do is allow the user to delete/edit entries in the view using the keyboard (catching windows messages for the view) and also using the toolbar and menu on the main window. How can I communicate with the view through the main window class? I'm finding it confusing trying to figure out the message maps for both view and frame. I'm sure it will fall together when I get other peoples' ideas. I hope my description wasn't too confusing :) Any help will be appreciated.
Nathan, Check out this article on msdn: http://support.microsoft.com/support/kb/articles/Q108/5/87.asp This article explains how to access your doc or view from anywhere in your app (code). I think its what you are looking for. Frank
-
I'm working on a personal project using MFC. I'm still a beginner with it, however One thing that I'm having problems with is trying to figure out how to communicate between the different components of my application. I have a Main Frame window with the Report Control View (http://www.codeproject.com/miscctrl/reportctrl.asp), a toolbar, and a menu. Now, what I would like to do is allow the user to delete/edit entries in the view using the keyboard (catching windows messages for the view) and also using the toolbar and menu on the main window. How can I communicate with the view through the main window class? I'm finding it confusing trying to figure out the message maps for both view and frame. I'm sure it will fall together when I get other peoples' ideas. I hope my description wasn't too confusing :) Any help will be appreciated.
How can I communicate with the view through the main window class? 2 ideas: CFrameWnd::GetActiveView() and cast to your view class or keep a pointer to your view as a member of your frame class. Set it in OnCreate(...) Now if only someone would answer my question. I did this for good karma :)