Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / January 2007

Tip: Looking for answers? Try searching our database.

IDTCommandTarget.QueryStatus and vsCommandStatusInvisible

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dirk - 27 Sep 2006 16:28 GMT
Hello

In a visual studio add-in (C#) I add a new command to the Commands collection and an associated control to the context menu of
Solution Explorer. If I set the StatusOption to vsCommandStatusSuppported | vsCommandStatusInvisible in
IDTCommandTarget::QueryStatus the control remains visible, though gray. I should expect that the control is not visible at all,
basically I want to hide or show the context menu control depending on the file extension of the selected item. I found that this
only works in the first session when the CommandBarButton control is newly added to the context menu. In subsequent sessions it is
always displayed. To work around this problem I delete the CommandBarButton control in OnConnection and add it again to the context
menu. The command is not deleted/added. Then the vsCommandStatusInvisible is respected. Is this a known bug?

Thanks
Dirk
Carlos J. Quintero [VB MVP] - 28 Sep 2006 10:04 GMT
vsCommandStatusSupported | vsCommandStatusInvisible is not honored by a bug,
according to MS. See the last post of the thread:

http://groups.google.es/group/microsoft.public.vsnet.ide/tree/browse_frm/thread/
7f7bab1c295af16f/b0e0ece3ea2de809


As a workaround if you do NOT return vsCommandStatusSupported, the command
should remain invisible. In fact I think there was no need for the
vsCommandStatusInvisible flag...

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> Hello
>
[quoted text clipped - 15 lines]
> Thanks
> Dirk
dirk - 28 Sep 2006 14:48 GMT
And what should I return instead? I tried vsCommandStatusUnsupported and
also
making no assignment in cases where I would use vsCommandStatusInvisible.
This
does not work, it is always visible (gray).
I also found the thread you posted, but had hoped this only applies to VS
2003 and
were fixed in VS 2005.

Thanks
Dirk

> vsCommandStatusSupported | vsCommandStatusInvisible is not honored by a bug,
> according to MS. See the last post of the thread:

http://groups.google.es/group/microsoft.public.vsnet.ide/tree/browse_frm/thread/
7f7bab1c295af16f/b0e0ece3ea2de809


> As a workaround if you do NOT return vsCommandStatusSupported, the command
> should remain invisible. In fact I think there was no need for the
[quoted text clipped - 19 lines]
> > Thanks
> > Dirk
Josh - 04 Jan 2007 18:28 GMT
I was having similar issues. The reason that it never changes is because it is setup as a perm, rather then temp addin. See this article:
http://www.itpost.cn/en/1965/posts/196564142.shtml

Quick fix.
In OnConnection, add the command when:
connectMode = ext_ConnectMode.ext_cm_Startup
not
connectMode = ext_ConnectMode.ext_cm_UISetup

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.