Mainframe menu problem in splitter window application
arie -- bis1b@chava.netmedia.net.il Sunday, November 10, 1996 Environment:Win 3.11/Win95;VC 1.52 I have SDI app where I use two panes (CView1 and CView2)in splitter window. When I select my (non-default) item in MainFrame menu(f.e.ID_CREATEMYDLG) my dialog is created and everything works OK. The problem is when I click in CView2 window and then select ID_CREATEMYDLG item any action doesn't perform - it just ignores my selection. If I click now in CView1 and then select the same item it again works properly.(There are not any problem ,however ,with such default MFC items like ID_FILEOPEN ) Has anybody any suggestions how to solve the problem? Thank you in advance. Arie Goberman Jerusalem BIS Sofware Systems. e-mail address: goberman@bis.co.il
Doug Brubacher -- Doug_Brubacher@compuware.com Monday, November 11, 1996 [Mini-digest: 3 responses] Arie, Sounds like you implemented the message handler for ID_CREATEMYDLG in CView1 when you really want to handle it in the Document or Mainframe. Regards, Doug Brubacher DouglasB@msn.com PS. This is an advanced MFC question? [Moderator's note: I take it we have a volunteer to take over as moderator in a few months... ;-)] -----From: Roger Onslow/Newcastle/Computer Systems Australia/AU >I have SDI app where I use two panes (CView1 and CView2) >in splitter window. So far so good, nothing unusual there... >When I select my (non-default) item in MainFrame >menu(f.e.ID_CREATEMYDLG) my dialog is >created and everything works OK. Also seems fine, just what you'd expect >The problem is when I click in CView2 window and then select >ID_CREATEMYDLG item any action doesn't perform >- it just ignores my selection. What exactly do you mean -- "doesn't perform"? Does the OnCreateMyDlg (or whatever) handler get called, but the dialog is not created? Or is the message never received/handled? I assume the handler for ID_CREATEMYDLG is in your mainframe class, and that it is not handled by the view class. If not, then the active view will handle the message, and if you are only handling it in one of you view classes, then if the other view class is the active one, the message won't get handled. This should be obvious, but then, one doesn't always see the obvious :-) > If I click now in CView1 and then select the same item it again works >properly.(There are not any problem ,however ,with such default MFC >items like ID_FILEOPEN ) >Has anybody any suggestions how to solve the problem? Try adding dummy handlers for this message in each of the view classes (as well as the mainframe) and see which ones (if any) get called. If you remove the handlers from the view classes, you should find that the mainframe class will handle your command no matter which view is active. Roger -----From: Konstantin KovalenkoI might be wrong but I think the problem is that the implementation of that "ID_CREATEMYDIALOG" is in the implementation file for CView1. Move it to the Document implementation file (.cpp). You may set the flag for CframeWnd m_bAutoMenuEnable and that menu item will be disabled when you are in Cview2 and enabled when you are in Cview1.
SachinX Keskar -- SachinX_Keskar@ccm.jf.intel.com Monday, November 11, 1996 Text item: Check whether you are handling the message in View2. Also make sure you are enabling the item in Command API. In cases like these I would probably put the handler in the document class and depending on the active view take proper action. Sachin Environment:Win 3.11/Win95;VC 1.52 I have SDI app where I use two panes (CView1 and CView2)in splitter window. When I select my (non-default) item in MainFrame menu(f.e.ID_CREATEMYDLG) my dialog is created and everything works OK. The problem is when I click in CView2 window and then select ID_CREATEMYDLG item any action doesn't perform - it just ignores my selection. If I click now in CView1 and then select the same item it again works properly.(There are not any problem ,however ,with such default MFC items like ID_FILEOPEN ) Has anybody any suggestions how to solve the problem? Thank you in advance. Arie Goberman Jerusalem BIS Sofware Systems. e-mail address: goberman@bis.co.il Text item: External Message Header The following mail header is for administrative use and may be ignored unless there are problems. ***IF THERE ARE PROBLEMS SAVE THESE HEADERS***. Reply-To: mfc-l@netcom.com Precedence: bulk Errors-To: owner-mfc-l@majordomo.netcom.com Sender: owner-mfc-l@majordomo.netcom.com
| Вернуться в корень Архива |