Microsoft Developer Network >
Forums Home
>
Microsoft Visual Studio 2010 Beta 2 Forums
>
Visual Studio Extensibility Beta 2
>
Unable to hide a command with combo-box
Unable to hide a command with combo-box
- Hi,
I have a command with a combo-box in my unmanaged package. This command is located in the Tools menu. I try to control the visibility of this combo-box in the QueryStatus method of the package:
In addition, the combo-box should be invisible if my package is not loaded. So I declare it this way:void Update_ComboCommand(const CommandHandler& handler, OLECMD* prgCmds, OLECMDTEXT* pCmdText){<br /> if (m_EnabledCombo) prgCmds->cmdf = OLECMDF_ENABLED | OLECMDF_SUPPORTED; else prgCmds->cmdf = OLECMDF_INVISIBLE | OLECMDF_SUPPORTED;<br /> }
#define DIS_DEF DEFAULTDISABLED | DEFAULTINVISIBLE | DYNAMICVISIBILITY
In practice in VS2010 when the combo-box should be invisible it is displayed as disabled, including when the package is not loaded. However, if I register my package for VS2005, the combo-box works as expected.
COMBOS_BEGIN
// Combo Box ID, Group ID, Priority, Fill Command ID, Width, Type, Flags, Button Text, Menu Text, ToolTip Text, Command Name;
guidVsPackage2CmdSet:cmdidCombo, guidVsPackage2CmdSet:MyMenuGroup, 0x114, cmdidComboFill, 75, IndexCombo, DIS_DEF, "Package 2 Combo", "Package 2 ComboBox";
COMBOS_END
I tried to change the flags of the combo-box to DEFAULTINVISIBLE | DYNAMICVISIBILITY and change the command handler this way:
but this did not yield expected results, too.void Update_ComboCommand(const CommandHandler& handler, OLECMD* prgCmds, OLECMDTEXT* pCmdText){ if (m_EnabledCombo) prgCmds->cmdf = OLECMDF_ENABLED | OLECMDF_SUPPORTED; else prgCmds->cmdf = OLECMDF_INVISIBLE | OLECMDF_SUPPORTED | OLECMDF_ENABLED; }
What do I do incorrectly? Or is this a bug? This problem is reproduced with a simple example which is a modified wizard's template. The command handler is called. So I don't understand this behavior.
Any help will be appreciated.
Thanks,
Roman
Answers
- Hi Roman,
I checked with the developer on the new WPF command bars feature. It should indeed be possible to control visibility of combo boxes on menus through QueryStatus. It looks like a bug in VS 2010 Beta 2. No promises, but we'll investigate a fix for the VS 2010 Release Candidate.
Thanks for the report!
- Paul Harrington.
Visual Studio Platform and Ecosystem- Marked As Answer byPaul HarringtonMSFT, ModeratorThursday, November 05, 2009 5:11 AM
All Replies
- Hi Roman,
I checked with the developer on the new WPF command bars feature. It should indeed be possible to control visibility of combo boxes on menus through QueryStatus. It looks like a bug in VS 2010 Beta 2. No promises, but we'll investigate a fix for the VS 2010 Release Candidate.
Thanks for the report!
- Paul Harrington.
Visual Studio Platform and Ecosystem- Marked As Answer byPaul HarringtonMSFT, ModeratorThursday, November 05, 2009 5:11 AM

