Skip to content

HitTest Method

Description

The HitTest method determines if a ShortcutBarItem is at a specific X and Y coordinate.

Syntax

Public Function HitTest( _
    ByVal [x](#) As Long, _
    ByVal [y](#) As Long _
) As [ShortcutBarItem](XtremeShortcutBar~ShortcutBarItem.md)

Parameters

  • x: X coordinate to test.
  • y: Y coordinate to test.

Return Type

A pointer to a ShortcutBarItem that occupies the specified point or Nothing if no item occupies the point.

Example

This sample illustrates how to determine if an item is at a specific X and Y coordinate.

Private Sub wndShortcutBar_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)

    ' Used to store the item  
    Dim Item As ShortcutBarItem

    ' Test the X and Y coordinates of the mouse when the button is released to see if an item  
    ' is under the mouse cursor.  
    ' If an item is not at the X and Y coordinates, Nothing is returned  
    Set Item = wndShortcutBar.HitTest(x, y)  

    ' If an item was at the specified X and Y coordinates then print its caption.  
    If Not Item Is Nothing Then  
        Debug.Print Item.Caption & " was hit"  
    End If  

End Sub

See Also

ShortcutBar Control


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.