News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Opening the context-menu by right-clicking on a blank Page?

Started by MaxKasparek, April 09, 2013, 03:57:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MaxKasparek

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:

   
    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:


        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

#1
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.

Best Regards,

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

JuneTheSecond

Best Regards,

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

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 180 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1068KB.
Tokens: post-login.
Cache hits: 13: 0.00142s for 26,765 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]