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 / July 2006

Tip: Looking for answers? Try searching our database.

How to get toggle dropdown to work on a custom toolbar added by ad

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nitramsen@nospam.nospam - 30 Jun 2006 17:02 GMT
I have made an add-in for Visual-Studio 2005 that adds a toolbar to the UI.

The toolbar works fine, but when I click the arrow pointing down next to the
toolbar and click “Add or remove Buttons” my toolbar name is disabled(Grayed
out) and I can not get the dropdown where I can toggle the state of the
individual commands in the toolbar . I can add/remove items to/from the
toolbar by choosing customize.. in the Tools menu.

I add the Command to the toolbar like this:

CommandBar toolbar = (CommandBar)
_applicationObject.Commands.AddCommandBar("Test",
vsCommandBarType.vsCommandBarTypeToolbar, null, 1);
CommandBarButton command = (CommandBarButton)TestCommand.AddControl(toolbar,
position++); //TestCommand created with
((Commands2)_applicationObject.Commands).AddNamedCommand2
command.Style = MsoButtonStyle.msoButtonIcon;

Does any known how to get this to work?

I have tried different protection levels on the CommandBar but that did not
change anything.

Brgds
  Martin
Carlos J. Quintero [VB MVP] - 03 Jul 2006 10:09 GMT
I have reproduced the situation. I guess that that only works for built-in
commandbars of Visual Studio, not for add-in command bars, because the
layout is stored by VS and add-ins don´t have access to it, so the next time
the changes are lost.

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

>I have made an add-in for Visual-Studio 2005 that adds a toolbar to the UI.
>
[quoted text clipped - 25 lines]
> Brgds
>   Martin
"Gary Chang[MSFT]" - 03 Jul 2006 11:54 GMT
Hi Martin,

Thank you posting!

Based on the description, the problem is your custom commandbar will be
disabled after you click its pointing down arrow and its configuration
dropdown menu is inaccessible either. Please correct me if I misunderstand
anything.

In order to isolate this issue, we may need more detailed info it. Would
you please provide a simple stand-alone project (zipped) for us to
research? You can send it to my mailbox directly. (Please remove the
"online" of my email address alias)

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
nitramsen@nospam.nospam - 03 Jul 2006 14:40 GMT
Hi Gary,
Thanks for your answer.

Let me clarify my problem:

The CommandBar is not disabled after clicking on the arrow pointing down.
But the dropdown configuration menu with the same name as my custom
CommandBar is always inaccessible(Grayed out).

Think that I may need to setup menu points in the dropdown configuration
menu, but I can not figure out how to do this.

I will send you a little project demonstrating what I mean.

BRGDS
  Martin

> Hi Martin,
>
[quoted text clipped - 21 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 04 Jul 2006 04:27 GMT
Hi Martin

Thanks for your sample project!

I have already tested it and consulted it with our product develop team,
they confirmed Carlos' opinion.

"That configuration dropdown menu only works for built-in command bars.

From your sample code, command bars added like that are (almost) the same
as command bars added via the "Tools/Customize..." UI (click the "New..."
button on the Toolbars tab). Since they've been constructed completely out
of thin air, there is no "built in" state to revert to. Imagine what would
happen if we allowed you to toggle the state of one of these commands off.
That would delete the command entirely with no way to get it back.

For add-ins, using this object model is fairly simple, but there are a
couple of drawbacks:
1. they don't persist across sessions (real user customizations do). All
objects created this way have their "Temporary" property set to true.
2. Users can 'undo' your customizations via the customization UI (they can
delete your toolbar and/or rearrange your commands)"

Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
nitramsen@nospam.nospam - 04 Jul 2006 20:05 GMT
Hi Gary,

Thanks, for you answer. Does this apply to Managed and Unmanaged add-ins or
is it possible to get this functionality using an unmanaged add-in?

Further I do not get why it should be impossible to do this as I do not
assume that the commands are delete when they are removed from a commandbar
but only deactivated.

But then again maybe I just don’t get it.

Brgds
  Martin

> Hi Martin
>
[quoted text clipped - 30 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 05 Jul 2006 04:28 GMT
Hi Martin,

>Thanks, for you answer. Does this apply to Managed
>and Unmanaged add-ins or is it possible to get this
>functionality using an unmanaged add-in?

Our development lead suggests:

"To create add-ins that persist across sessions, and are more "built in",
you should take a look at the IVsProfferCommands interface (especially the
AddCommandBar method). The command bars and commands created through this
interface are "closer to the metal" in their interactions with the command
system. I believe (although I haven't had time to confirm) that they also
give you the "built-in" feel you're looking for - users can further
customize them via "Tools/Customize..." or "Add or remove Buttons", but
they cannot remove your commands and toolbars."

>Further I do not get why it should be impossible
>to do this as I do not assume that the commands
>are delete when they are removed from a
>commandbar but only deactivated.

I am afraid this behavior is by design, because it is not a "built in"
commandbar.

Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
nitramsen@nospam.nospam - 05 Jul 2006 09:02 GMT
Hi Gary,

Thanks, I will try this.

brgds
  MArtin

> Hi Martin,
>
[quoted text clipped - 32 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 06 Jul 2006 04:09 GMT
You are welcome, Martin. :)

Good Luck!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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.