Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Enable-Disable Menu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Enable-Disable Menu

 Post Reply Post Reply
Author
Message
KumarCJ View Drop Down
Groupie
Groupie
Avatar

Joined: 02 April 2007
Location: India
Status: Offline
Points: 96
Post Options Post Options   Thanks (0) Thanks(0)   Quote KumarCJ Quote  Post ReplyReply Direct Link To This Post Topic: Enable-Disable Menu
    Posted: 23 August 2007 at 8:33am

Hi,

In the FILE menu, under FILE menu we have Open, Save, Export (Export contain Export DB and Export Text submenu).

File menu looks like below:

File
  Open
  Save
  Export > Export DB    (ID_EXP_DB)
                 Export Text  (IDM_EXP_TEXT)

  Print
  Exit

How can I disable the "Export DB" which is submenu of "Export" menu, based on certain condition.

I tried with below given code. Please suggest.
 
For rest of the menu items I am enabling and diabling using below code.

CXTPPopupBar* pCommandBar;

int nCount = pCommandBar->GetControls()->GetCount();
int i = 0;
for (i = 0; i < nCount; i++)
{
CXTPControl* pCommandBarNew =  pCommandBar->GetControl(i);
 
if (pCommandBarNew->GetID() == ID_FILE_PRINT) //Print
{
 if(var == NULL)
{
 pCommandBarNew->SetEnabled(FALSE);
 pCommandBarNew->SetFlags(xtpFlagManualUpdate);
}
else
{
 pCommandBarNew->SetEnabled(TRUE);
 pCommandBarNew->SetFlags(xtpFlagManualUpdate);
}
}
}

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.032 seconds.