Print Page | Close Window

MFC C++ Dialog-based right click SubMenu Issue

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=22495
Printed Date: 21 November 2024 at 6:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MFC C++ Dialog-based right click SubMenu Issue
Posted By: SubDrag
Subject: MFC C++ Dialog-based right click SubMenu Issue
Date Posted: 19 December 2014 at 10:55pm
I'm using the latest Skin framework for MFC C++ VS 2008 in a dialog-based application.  It works great, except for right click submenus.  Instead of showing the menu, it just shows a little button.  This happens on all themes, cjstyles or msstyles.  It happens in a CMenu, TrackPopupMenu call.

What do I do to fix this?

http://gyazo.com/4deb0b885df1607bc05f9bdbfd22e5fa



Replies:
Posted By: SubDrag
Date Posted: 19 December 2014 at 11:28pm
I have an update to the problem - it only happens on submenus that are not statically defined but added on the fly before showing.   

I have recreated it in the test Skin Controls app.  

void CSkinControlsDlg::OnToolbarDropDown(NMHDR* /*pNotifyStruct*/, LRESULT* /*result*/ )
{
RECT rc;
m_wndToolBar.GetItemRect(1, &rc);
m_wndToolBar.ClientToScreen(&rc);

CMenu menu;
menu.LoadMenu(IDR_MENU_POPUP);

UINT startBitFlags = 10000;
CMenu tempMenu1Main;
tempMenu1Main.CreatePopupMenu();

CMenu* menuLoaded = menu.GetSubMenu(0);

for (int y = 0; y < 50; y+=50)
{
CMenu tempSubMenu1;
tempSubMenu1.CreatePopupMenu();

for (int x = 0; x < 50; x=x++)
{
CString tempStr;
tempStr.Format("Item %04X", x+y);
tempSubMenu1.AppendMenu(MF_STRING | MF_ENABLED, (startBitFlags+x+y), "Item");
}

tempMenu1Main.InsertMenu(y/50, MF_BYPOSITION | MF_POPUP, (UINT_PTR)tempSubMenu1.m_hMenu, "SubMenu");
}

CString csMnuText;
menuLoaded->GetMenuString(2, csMnuText, MF_BYPOSITION);
menuLoaded->DeleteMenu(2, MF_BYPOSITION); //delete old popup
menuLoaded->InsertMenu(2, MF_BYPOSITION | MF_POPUP, (UINT_PTR)tempMenu1Main.m_hMenu, csMnuText);

TrackPopupMenu(menuLoaded->GetSafeHmenu(), 0, rc.left, rc.bottom, 0, m_hWnd, 0);
}


It seems the predefined submenus are working, but not these - it does work without loading any skins.  This is done, then the menu is shown.  It works without code jock skinning. 

There must be a way to fix this.

Also, when I tried to just disable popup menus just as a test using SetApplyOptions (1 | 2 | 4)...the popup menus reverted fine...but the main menu didn't work at all.


Posted By: mcmastl
Date Posted: 20 April 2015 at 1:53pm
We have informed our development team of the issue and will be looking into it.  Thank you for bringing this to our attention.  If the issue has been resolved please let us know.  

-------------
Luke McMasters, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net