Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / HotSpots Object / HotSpotsEnabled Property
Example
In This Topic
    HotSpotsEnabled Property (HotSpots)
    In This Topic
    Gets or sets a value indicating whether hotspots are enabled.
    Syntax
    expression.HotSpotsEnabled As Boolean
    where expression is a variable that represents a HotSpots Object
    Example
    This example creates a hotspot, adds it to the hotspots map, and enables hotspots for the session.
    '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