InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / InputMapAction Object / ActionID Property
Example
In This Topic
    ActionID Property (InputMapAction)
    In This Topic
    Gets or sets the action ID associated with this action.
    Syntax
    expression.ActionID As InputMapActionID
    where expression is a variable that represents a InputMapAction Object

    Property Value

    An InputMapActionID value
    Example
    This example creates two actions, adds actionIDs to those actions, and adds them to an action sequence. Then it adds the action sequence to to a hotspot.
    'This example creates a hotspot on an item in an option list (the "mtest3" option).
    '    1. mtest1   - Greeting
    '    2. mtest2   - Test2
    '    3. mtest3   - Selective Erase
    '    4. mtest4   - Save\Restore cursor and attributes
    '    5. mtest5   - Demo
    'enter your choice:
     
    'When clicked, the hotspot enters "3" on the command line to select that option. It also saves the hotspot
    'in a new hotspot file and applies it to the session.'
    Sub AddAHotspot()
     
        'Create a new action sequence
        Dim myActionSeq As New InputMapActionSequence
        
        'Add an action to send menu item "3" and add the action to the action sequence
        Dim myAction As New InputMapAction
        myAction.ActionId = InputMapActionID_SendHostTextAction
        myAction.AddParameter "3" & Chr(13)
        myActionSeq.Add myAction
        
     
        'Add an action to send the Enter control key and add this action to the action sequence
        Dim myAction2 As New InputMapAction
        myAction2.ActionId = InputMapActionID_SendHostKeyAction
        myAction2.AddParameterAsInteger ControlKeyCode_Enter
        myActionSeq.Add myAction2
     
        
        'Add a new hotspot that is activated by the 'mtest4' string on the screen menu item 4
        Dim myHotSpot As New Hotspot
        myHotSpot.text = "mtest3"
     
        'Add a tooltip for the hotspot
        myHotSpot.Tooltip = "Go to Selective Erase"
             
        'Link the action sequence to the hotspot
        Set myHotSpot.ActionSequence = myActionSeq
     
        'Add the new hotspot to the currently selected hotspots
        ThisScreen.ScreenHotSpots.AddHotspot myHotSpot
         
        
        'Make sure hotspots are enabled
        ThisScreen.ScreenHotSpots.ApplyCurrentHotspots
        
        'At this point you can use the new hotspot in the session -- it is "in memory" only at this point
        
        'To permanently assign the hotspot, you need to save the hotspot map.
        'You can save the current hotpot map or create a new map hotspots map file.
        
        'Save the current map
        ThisScreen.ScreenHotSpots.Save
        
        'If you create a new hotspots map file, you'll need to apply the new map to the session
        
        'Save the current hotspots in a new hotspots map file
        'Dim newHotspotsMap As String
        'newHotspotsMap = Environ("USERPROFILE") & "\Documents\micro focus\reflection\Hotspots Maps\MyCustomHotspotsMap.xhs"
        'ThisScreen.ScreenHotSpots.SaveAs (newHotspotsMap)
        
        'Assign the new hotspot map to the session
        'ThisScreen.ScreenHotSpots.HotspotsMap = newHotspotsMap
         
     
    End Sub
    'This example creates a hotspot on an item in an option list (the "mtest3" option).
    '    1. mtest1   - Greeting
    '    2. mtest2   - Test2
    '    3. mtest3   - Selective Erase
    'When double-clicked, the hotspot enters "3" on the command line to select that option.
     
    Sub AddHotspotAndCreateHotspotMap()
     
        'Create a new action sequence
        Dim myActionSeq As New InputMapActionSequence
        
        'Add an action to send menu item "3" and add the action to the action sequence
        Dim myAction As New InputMapAction
        myAction.ActionId = InputMapActionID_SendHostTextAction
        myAction.AddParameter "3" & Chr(13)
        myActionSeq.Add myAction
        
        'Add an action to send the Enter control key and add this action to the action sequence
        Dim myAction2 As New InputMapAction
        myAction2.ActionId = InputMapActionID_SendHostKeyAction
        myAction2.AddParameterAsInteger ControlKeyCode_Enter
        myActionSeq.Add myAction2
     
        'Add a new hotspot that is activated by the 'mtest3' string on the screen menu item 3
        Dim myHotSpot As New Hotspot
        myHotSpot.text = "mtest3"
     
        'Add a tooltip for the hotspot
        myHotSpot.Tooltip = "Go to Selective Erase"
             
        'Link the action sequence to the hotspot
        Set myHotSpot.ActionSequence = myActionSeq
     
        'Add the new hotspot to the currently selected hotspots map
        ThisScreen.ScreenHotSpots.AddHotspot myHotSpot
        
        'Make sure Hotspots are enabled and display as buttons
        ThisScreen.ScreenHotSpots.HotSpotsEnabled = True
        ThisScreen.ScreenHotSpots.HotSpotStyle = HotspotStyleOption_Button
        
        'Apply the hotspots
        ThisScreen.ScreenHotSpots.ApplyCurrentHotspots
         
        'At this point you can use the new hotspot in the session -- but it is "in memory" only
        
        'If you are using a custom hotspot map that resides in your user data directory, you can save the current hotspot map using the Save method. This doesn't work if you
        'are using a default hotspot in the programs directory because saving a default hotspot just creates a new file in the user data directory and doesn't reassign it to the session.
        'ThisScreen.ScreenHotSpots.Save
        
        'If you are using a default hotspot, save the current hotspots in a new hotspots map file and assign it to the session as follows:
        Dim newHotspotsMap As String
        newHotspotsMap = Environ("USERPROFILE") & "\Documents\micro focus\reflection\Hotspots Maps\MyCustomHotspotsMap.xhs"
        ThisScreen.ScreenHotSpots.SaveAs (newHotspotsMap)
        
        'Assign the new hotspot map to the session
        ThisScreen.ScreenHotSpots.HotspotsMap = newHotspotsMap
     
    End Sub
    See Also