Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Enable, Disable, SetText, SetCheck in CExtMenuControlBar items Collapse All
Subject Author Date
Charles Bisbee Nov 10, 2010 - 2:56 PM

I need to be able to do the following


Enable Disable (make gray) a menu item

Set a check by a menu item

Change the text of a menu item.


So far I have discovered that CExtMenuControlBar   ( m_wndMenuBar) derives from CExtToolControlBar which has several functions of interest these are

CommandToIndex(ID)

GetButtonStyle

SetButtonStyle




One would think that these would do it so I have the code 


  int nIndex=m_wndMenuBar.CommandToIndex(ID);

  if(nIndex!=-1)

  {

    UINT nStyle= m_wndMenuBar.GetButtonStyle( nIndex );

    if(bEnable)

    {

      //nStyle |=

    }

    else

    {

      //nStyle &= ~

    }

   m_wndMenuBar.SetButtonStyle(nIndex,nStyle);

  }


When DoDataExchange is run apparently the m_wndMenuBar is not initialized stepping into the code shows 0 buttons  So I can’t set them up there

Later it does not work as there are three buttons.  These are the toplevel button (File …)  So I need a way to drill down into the next level for this to have a hope of working

Finally the help file for ProfUIS does not list the styles.  It only says they are defined by the “TBSS_XXXX” standard.  Searching on the ProfUIS dir for these finds a very few entries of absolutely no use for enable disable check uncheck.


Please help me with ways to meet this requirement.  It was EASY before ProfUIS


Maybe it can be done the same way I did it before using CExtMenuControlBar::GetMenu and then standard menu functions.  So I tried old way again with modifications.  It looks like


  CMenu *pMenu=m_wndMenuBar.GetMenu();

  ASSERT(pMenu);

  if(pMenu)

  {

    CMenu *pSubMenu=pMenu->GetSubMenu(nSubMenu);

    ASSERT(pSubMenu);

    if(pSubMenu)

    {

       pSubMenu->EnableMenuItem(ID,bEnable);

       m_wndMenuBar.UpdateMenuBar();

    }

  }


This results in the top level menu items disappearing.


 

Technical Support Nov 11, 2010 - 12:12 PM

We would like to create a sample app for you. Please let us know which kind of window is parent of CExtMenuControlBar in your application? I.e. we need to know whether our test project should be dialog based, SDI or MDI?