Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - LoadMenu discard the MFS_GRAYED flag?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

LoadMenu discard the MFS_GRAYED flag?

 Post Reply Post Reply
Author
Message
blueseaing View Drop Down
Groupie
Groupie


Joined: 14 June 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote blueseaing Quote  Post ReplyReply Direct Link To This Post Topic: LoadMenu discard the MFS_GRAYED flag?
    Posted: 13 September 2004 at 1:44am

I have such code

  CMenu cMenu;
  VERIFY(cMenu.LoadMenu(IDR_FAVORITE_POPUP));
  CMenu* pPopup = cMenu.GetSubMenu(0); 
  pPopup->EnableMenuItem(ID_FAVORITE_DELETE,MF_GRAYED);
  CXTPCommandBars::TrackPopupMenu(pPopup,TPM_LEFTALIGN, point.x, point.y,this, NULL);

  but the MF_GRAYED not appeared, and if i use the winapi ::TrackPopupMenu() and the
effect will appear, so I study the source code of XTP,and added such code belows:

BOOL CXTPCommandBar::LoadMenu(CMenu* pMenu, BOOL bRemoveControls)
{
 if (!pMenu || !::IsMenu(pMenu->m_hMenu))
  return FALSE;

 if (bRemoveControls)
  m_pControls->RemoveAll();
 
 BOOL bSeparator = FALSE;
 for (int i = 0; i < ::GetMenuItemCount(pMenu->m_hMenu); i++)
 {
  // Check to see if the item is a separator, we don't want
  // to use GetMenuItemID(i) because it may not equal zero.
  MENUITEMINFO info = { sizeof(MENUITEMINFO), MIIM_TYPE };
  ::GetMenuItemInfo(pMenu->m_hMenu, i, TRUE, &info);

  if ((info.fType & MFT_SEPARATOR) == MFT_SEPARATOR)
   bSeparator = TRUE;
  else
  {
   CXTPControl* pControl = m_pControls->AddMenuItem(pMenu, i);

   if (pControl && bSeparator)
   {
    pControl->SetBeginGroup(TRUE);
    bSeparator = FALSE;
 
   }

   //added such code but the SetEnabled() function  don't effect ??? why??
   if (info.fState & MFS_GRAYED)
   {
    pControl->SetEnabled(FALSE);
    
   }
  }
 }
 CFrameWnd* pFrame = GetParentFrame();
 if (pFrame) pFrame->DelayRecalcLayout();
 return TRUE;
}

why?? does the xtp discard the MFS_GRAYED???

 

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2004 at 11:53pm
it works with 9.10   with TPM_NONOTIFY flag
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
blueseaing View Drop Down
Groupie
Groupie


Joined: 14 June 2004
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote blueseaing Quote  Post ReplyReply Direct Link To This Post Posted: 20 September 2004 at 7:35pm
how can i solve the promblem in xtp8.7, do have any hot fix? please help me.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 21 September 2004 at 6:57am

Add UPDATE handler for ID_FAVORITE_DELETE and call

pCmdUI->Enable(FALSE);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.