![]() |
Popup Menu Items Greyed / Disabled |
Post Reply ![]() |
Author | |
djtompa ![]() Newbie ![]() ![]() Joined: 29 November 2004 Location: Germany Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() Posted: 09 March 2005 at 10:42am |
I 've created a CXTMenu m_mymenu which I want to display. CXTPCommandBars::TrackPopupMenu(m_mymenu,NULL, p.x, p.y, m_myview); Using above command the menu displays correctly, but all entries are grey. This only happens if I use on-the-fly-generated ids in AppendMenu(...). If ids from e.g. the ToolBar are used everything works fine. What's the problem? |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
use TPM_NONOTIFY flag.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
djtompa ![]() Newbie ![]() ![]() Joined: 29 November 2004 Location: Germany Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Short and Simple :-) Thank you! |
|
![]() |
|
BruceW ![]() Newbie ![]() Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
Hi,
I experience the same problem, even after setting TPM_NO_NOTIFY. My code is as follows: ...... // get a pointer to the application window. CXTPMDIFrameWnd* pMainWnd = DYNAMIC_DOWNCAST(CXTPMDIFrameWnd, AfxGetMainWnd()); // get a pointer to the CXTPCommandBars object. CXTPCommandBars* pCommandBars = pMainWnd->GetCommandBars(); UINT nReturn = CXTPCommandBars::TrackPopupMenu( &popupMenu, TPM_NONOTIFY | TPM_RECURSE | TPM_RETURNCMD, ptCursor.x, ptCursor.y, pMainWnd, 0, 0, pCommandBars ); The CMenu has been created completely dynamically with the entries having the appropriate MF_GRAYED flag. It works if I use the standard TrackPopupMenu, but not with CXTPCommandBars. I am using a recently downloaded evaluation version. Am I doing something wrong? All help appreciated. Thanks, Bruce. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Yes, sorry, it does'n load this flag. II recommend you build directly CXTPPopupBar/CXTPControl objects instead CMenu and convret it in TrackPopupMenu: sample: CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(pCommandBars); pPopupBar->GetControls()->Add(xtpControlButton); ... pControl->SetEnabled(FALSE); .. pControl->SetChecked(TRUE); ... CXTPCommandBars::TrackPopupMenu(pPopupBar...)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BruceW ![]() Newbie ![]() Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Looking at the various examples and the online help, I tried a different approach, as follows (sample) void CMDISampleView::OnRButtonDown(UINT nFlags, CPoint point) { CMenu menu; menu.CreatePopupMenu(); menu.AppendMenu( MF_GRAYED, 1, "Entry" ); menu.AppendMenu( MF_SEPARATOR ); menu.AppendMenu( MF_GRAYED, 1, "Entry" ); CMenu submenu; submenu.CreatePopupMenu(); submenu.AppendMenu( MF_GRAYED, 1, "Entry" ); submenu.AppendMenu( MF_SEPARATOR ); submenu.AppendMenu( MF_ENABLED | MF_CHECKED, 1, "Entry" ); menu.AppendMenu( MF_STRING | MF_POPUP | MF_ENABLED, (UINT)submenu.m_hMenu, "Sub1" ); CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(0); pPopupBar->LoadMenu( &menu ); POINT ptCursor; CWinApp* pApp = AfxGetApp(); ::GetCursorPos(&ptCursor); UINT nReturn = CXTPCommandBars::TrackPopupMenu( pPopupBar, TPM_NONOTIFY| TPM_RETURNCMD, ptCursor.x, ptCursor.y, AfxGetMainWnd() ); } This works fine in my small sample example. However when I do the same in my main application (loading my CMenu the same way) it does not work. They grayed items are not shown. Is there some condition / size limit / other flags / etc. I am missing. Thanks, Bruce. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, as I wrote - "pPopupBar->LoadMenu" don't load state of items. don't use pPopupBar->LoadMenu( &menu ); and create all CXTPPopupBar dynamically. CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(0); pControl->SetCaption(..). pConttrol->SetEnabled(..); etc. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BruceW ![]() Newbie ![]() Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
Hi,
I understand that, however it DOES work in my small example above, but not in "real life". Is it possible to get icons to the labels where the icons are not in a resource file, and thus don't have an Id? Thanks, Bruce. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Attach project in issuetrack and we will find problem. Call pControl->SetIconId(xx) to set item icon. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
BruceW ![]() Newbie ![]() Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Will reproduce it in a small example project and load that up. Thanks, Bruce. Re Icon, since there are no Ids I think I will have to use SetCustomIcon. |
|
![]() |
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 |