Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / ContextMenus Object / DefaultContextMenu Property
Example
In This Topic
    DefaultContextMenu Property (ContextMenus)
    In This Topic
    Gets or sets the default context menu for this session document
    Syntax
    expression.DefaultContextMenu As ContextMenu object 
    where expression is a variable that represents a ContextMenus Object

    Property Value

    A ContextMenu object
    Example
    This example creates a new menu and names it "My Custom Menu." Then it assigns it as the default context menu.
    Public Sub ChangeContextMenu()
     
        Dim action As InputMapAction
        Dim sequence As InputMapActionSequence
        Dim menuItem As ContextMenuItem
        Dim OldDefaultMenu As contextMenu
        Dim MyCustomMenu As contextMenu
        
        'Save the current default menu
        Set OldDefaultMenu = New contextMenu
        Set OldDefaultMenu = ThisIbmTerminal.ContextMenus.ItemByName("Default")
        OldDefaultMenu.Name = "Default Menu"
        ThisIbmTerminal.ContextMenus.Add OldDefaultMenu
          
        'Create a new menu
        Set MyCustomMenu = New contextMenu
        MyCustomMenu.Name = "My Custom Menu"
        
        'Create an action sequence to hold the actions
        Set sequence = New InputMapActionSequence
            
        'set an action to open the Office Tools Pane and add to the sequence
        Set action = New InputMapAction
        action.ActionId = InputMapActionID_OfficeToolsPaneAction
        sequence.Add action
        
        'create the menu item for the Office Tools action and add it to the sequence
        Set menuItem = New ContextMenuItem
        menuItem.Name = "Open Office Tools"
        menuItem.MenuItemType = ContextMenuItemType_MenuItem
        Set menuItem.mapping = sequence
       
        'add the Office Tools menu item to the menu
        MyCustomMenu.AddMenuItem menuItem
        
        'Add the menu
        ThisIbmTerminal.ContextMenus.Add MyCustomMenu
        
        'Change the default menu
        Set ThisIbmTerminal.ContextMenus.DefaultContextMenu = MyCustomMenu
            
    End Sub
    See Also