Author Topic: Opening the context-menu by right-clicking on a blank Page?  (Read 4929 times)

0 Members and 1 Guest are viewing this topic.

MaxKasparek

  • Newbie
  • *
  • Posts: 9
Opening the context-menu by right-clicking on a blank Page?
« on: April 09, 2013, 10:57:50 AM »
Hey Guys,

as you can see, by reading the topic, i have Problems with the context-menus under Visio2010. With Visio 2003 and 2007 everything works fine and i never needed to change my code. But since 2010 the customized context menu isnt included in the context menu when i right-click on a blank Page. When i right-click on a shape, it doesnt matter on which one, it works on alll of them, the context menu looks like i want it to.

Is there any way to solve this Problem? When i start from zero and programm it via fluentUI like the Ribbon it wont change a thing, would it?

Here the import parts of the code:
Code
    
    Set DrawingDoc = ActiveDocument
    Set vsoUIObject = DrawingDoc.Application.BuiltInMenus
    Set vsoMenuSetsObj = vsoUIObject.MenuSets
    Set vsoMenuSetObj = vsoMenuSetsObj.ItemAtID(visUIObjSetCntx_DrawObjSel)
   
    Set vsoMenusObj = vsoMenuSetObj.Menus
    Set vsoMenuObj = vsoMenusObj(0)
    Set vsoMenuItemsObj = vsoMenuObj.MenuItems
   
    Call Modul_Toolbar.create_Pagemenu(vsoMenuItemsObj)

Example for what happens in create_Pagemenu:

Code
        Set vsoMenuItemObj = vsoMenuItemsObj.AddAt(0)
        vsoMenuItemObj.Caption = Shape_UEbersicht_D
        vsoMenuItemObj.AddOnName = "ThisDocument.statistik"
        vsoMenuItemObj.TypeSpecific1 = visIconIXDRAWINGEXPLORER

I hope this is enough for you to understand the way i create my context-menu.

i appreciate any help,
bye,
Max

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Opening the context-menu by right-clicking on a blank Page?
« Reply #1 on: April 12, 2013, 02:28:24 AM »
I think visUIObjSetCntx_Page would have been better than visUIObjSetCntx_DrawObjSel.
ThisDocument.SetCustomMenus vsoUIObject is needed at the last of main program.
vsoMenuItemObj.Caption = "Shape_UEbersicht_D" in create_Pagemenu
should be vsoMenuItemObj.Caption = "Shape_UEbersicht_D".
Your macro worked well, when I replaced them.

And my recomendation is to declare all Visio objects like
    Dim DrawingDoc As Visio.Document
    Dim vsoUIObject As Visio.UIObject
    ........
    ........

with the first statement "Option Explicit" at the top of every module
to help you from easy mistakes.

« Last Edit: April 14, 2013, 06:32:11 AM by JuneTheSecond »
Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Opening the context-menu by right-clicking on a blank Page?
« Reply #2 on: April 14, 2013, 05:18:21 PM »
My responce is modified.
Best Regards,

Junichi Yoda
http://june.minibird.jp/