"OnInitMenuPopup" can not work, why? |
Post Reply |
Author | |
freehawk
Groupie Joined: 22 April 2004 Status: Offline Points: 95 |
Post Options
Thanks(0)
Posted: 22 July 2004 at 3:09am |
Hello : I added "OnInitMenuPopup" to my mainframe inherited from CXTPMDIFrameWnd, but after clicked the menu bar, the function was not called, Please help me, is it why? Thank you. -Freehawk
|
|
BruceW
Newbie Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
Post Options
Thanks(0)
|
Hi,
I have the same problem. My menus are dynamic and need to be modified depending on the MDI child view selected. Can anbody give me a different solution. Any help appreciated. Thanks, Bruce. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, I guess you tring to catch OnInitMenuPopup in MDI child? It must be catched inMDI parent. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
BruceW
Newbie Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
Post Options
Thanks(0)
|
No, I catch it in tne MDI parant. It used to work before subclassing off CXTPMDIFrameWnd, but now it does not.
Bruce. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
ohh. i see now. by OnInitMenuPopup I mean CommandBars version of this function
from Notifications sample:
ON_XTP_INITCOMMANDSPOPUP() ... void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pCommandBar) // Remove "New" menu item from the File menu. // Rename menu item "Save" to "Save Document". pCommandSave->SetCaption("&Save " + strCaption); // Rename menu item "Print..." to "Print Document...". pCommandPrint->SetCaption("&Print " + strCaption +"..."); // Sample of dynamic creation. Recommended to make it in OnCreateControl handler. CXTPPopupToolBar* pPopupBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pPopup->SetCommandBar(pPopupBar); }
// Combo box's List bar. pControl->ResetContent(); int nID = AFX_IDM_FIRST_MDICHILD; HWND hWndChild = ::GetDlgItem(m_hWndMDIClient, nID);
}
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
BruceW
Newbie Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
Post Options
Thanks(0)
|
Hi,
Solution works, thanks, though it is not quite the solution I was looking for. The requirement I have is to be able to modify the menus depending on the current selected view. Remember, the contents of the menus are dynamic, and so do not have specific IDs. On the first call to OnInitCommandsPopup the menu gets changed. However on the next call I would like the menu to be according to the original template (which has identifiable markers which I look for), so I can do the necessary changes again (according to the current selection), rather than trying to figure out what changes I need to undo first. The key point in the second and subsequent calls is that my original markers have been removed (they are dummy) and so it is difficult to know what to undo. Any ideas? Thanks, Bruce. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |