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

Tip: Looking for answers? Try searching our database.

New context menu for new project node

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stuart Carnie - 17 Mar 2006 00:50 GMT
I've created my own project type.

I've created two new node types, one of which is a 'virtual folder' for
my project package.  I've specified the MenuCommandId for my virtual
folder as "IDM_VS_CTXT_FOLDERNODE", so I could initially test adding a
menu item to this context menu.  It works.  This is not what I want to
do ultimately.  I really want a new context menu that will have 1 item,
'Install Addon'.

I cannot seem to get the context menu to work or pop up.  I did try
'ShowContextMenu', which didn't work.

My question is how do I add a _new_ context menu to my new 'virtual
folder' project node, which I derived from HierarchyNode.

Cheers,

Stuart Carnie
"Gary Chang[MSFT]" - 17 Mar 2006 09:22 GMT
Hi Stuart,

We have a discussion about a similar topic in this newsgroup before, you
may need to consider a lot of things to implement a custom context menu for
a project node. Please refer to the following MSDN newsgroup link for the
details:

http://msdn.microsoft.com/newsgroups/Default.aspx?query=Adding+a+command+to+
project+node+context+menu&dg=&cat=en-us-msdn&lang=en&cr=US&pt=&catlist=774F2
4A2-F71F-425F-AC2B-DC48AB0DA5C9&dglist=&ptlist=&exp=&sloc=en-us

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006.  Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
Stuart Carnie - 17 Mar 2006 16:30 GMT
Gary Chang[MSFT] wrote:
> Hi Stuart,
>
[quoted text clipped - 25 lines]
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================

Thanks Gary - I did read this article yesterday before posting, however
it discusses adding to an existing context menu, specifically the
IDM_VS_CTXT_PROJNODE.  I was able to successfully do this.

I changed my new virtual folder node to report the
IDM_VS_CTXT_FOLDERNODE for it's MenuCommandId property and updated my
VSCT file to use the IDM_VS_CTXT_FOLDERNODE as it's parent, and now my
new menu item shows up on all folder menus.  My problem is I want to
display a completely new context menu - unless you think there is a
better way.

Is there a way to hide menu items on a context menu for my node, so that
I could reuse an existing standard VS menu?

Cheers,

Stuart
"Ed Dore [MSFT]" - 17 Mar 2006 19:30 GMT
Hi Stuart,

Interesting, I thought the trick here would be to create your own context
menu in your CTC, and return it's ID from your override of the
MenuCommandId property, instead of one of the IDE's existing context menus.
But ultimately we also have to also stipulate the groupGuid in addition to
the menu id. It looks like this is hardcoded in the DisplayContextMenu to
pass VsMenus.guidSHLMainMenu, which means you'll need to override the
node's ShowContextMenu method and pass the appropriate menu id and
menugroup guid directly to the IVsUIShell.ShowContextMenu.

You could probably find a way to hide the exiting items by overriding the
QueryStatus implementation, but I think displaying your own context menu is
probably the better way to go.

Sincerely,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.
Stuart Carnie - 17 Mar 2006 21:21 GMT
Ed Dore [MSFT] wrote:
> Hi Stuart,
>
[quoted text clipped - 15 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.

Yes - this is exactly what I tried to do.  And found the same thing,
that the menugroup guid is the standard VSMenus.  That lead me to trying
to override either DisplayContextMenu or ShowContextMenu for my new
folder node (which is derived from HierarchyNode).  Neither of these
overridden methods were called, because the RMB is actually sent to the
ProjectNode and never passed down to actual node that was right-clicked.

Do you see this as a problem with the implementation of the hierarchy?

I didn't try debugging further to determine why it was being called this
way.  I will see what I can find.

Cheers,

Stu
"Gary Chang[MSFT]" - 22 Mar 2006 02:55 GMT
Hi Stuart,

Just wanted to check and see how things are going.

>I didn't try debugging further to determine why it was
>being called this way.  I will see what I can find.

Have you made any progress on this issue?

If you have any issues or concerns, please let me know. It's my pleasure to
be of assistance.

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006.  Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
Stuart Carnie - 22 Mar 2006 23:01 GMT
Gary Chang[MSFT] wrote:
> Hi Stuart,
>
[quoted text clipped - 26 lines]
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================

Gary, I am taking a different approach at the moment, so I may not need
to completely replace the menu.  I will certainly provide some feedback
if / when I come back to this problem.

Cheers and thanks again for your assistance,

Stuart
"Gary Chang[MSFT]" - 23 Mar 2006 04:17 GMT
That's OK, Struart. Thanks for your update and response. :)

Have a nice day!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006.  Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
==================================================
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.
Vin - 28 Mar 2006 17:43 GMT
Hi Stuart,
I've been reading your posts and replies and the reason for this is, I
am doing a similer project as you (VSpackage). Basically I have my own
file extension types called .mvfx files which are basically XML files.
My ultimate goal is to provide a visual designer for these files
associated with. Right now I've placed a webbrowser control over top of
the default editor pane and somehow able to inject HTML based on user's
events on this so called designer. But somehow I am not liking this. I
need to be able to get a designer more close to the HTML designer of
visual studio at the same time able to control how user can add nodes,
delete nodes to the underlying XML.
Could you please share your experience of creating your designer, and
how you went about doing it? It would gr8 help for me as well as the
community.
I've been trying to post my questions of various forums, but so far
haven't got to a solution.
Your help in this regards, will be gr8.
Thanks in advance,
Vin
Stu Carnie - 31 Mar 2006 01:25 GMT
Vin,

Interestingly I just saw your post today, looking through the
extensibility group using google.  For some reason it's not showing up
in Thunderbird nor Outlook Express.

Anyhow, I have created a designer, as you suggested, using a new
registered file type, "orm".  It is an XML file, so I wanted to be able
to edit the file via my visual designer or through the XML editor.  The
example provided in the SDK does demonstrate this, so I used that as a
basis for my designer.

Let me gather some more thoughts together and I'll post some more
detailed information.

Cheers,

Stuart

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.