Skip to content

TrackPosition Property

Description

Returns the current Time Line position within a TrackControlItem at the given X and Y coordinates. (Track Control)

Property Type

Read-only property

Syntax (Visual Basic)

Public Property TrackPosition() As Long

Return Type

Current position in "time" in a TrackControlItem at the given X and Y coordinates. Returns 0 if the item at the given X and Y coordinates is not a TrackControlItem.

Remarks

TrackPosition converts the current X coordinate of the mouse to the current position in "time" in the Time Line for the Track Control.

This is very helpful if you want to add a Block or Key to a track simply by clicking the mouse on a track.

Example

Dim pX As Integer

Private Sub TrackControl_MouseDown(Button As Integer, Shift As Integer, x As Long, y As Long)
    ' Get the current "time" the mouse was clicked at  
    pX = TrackControl.HitTest(x, y).TrackPosition  
End Sub

' Add a new block at the specified time
Private Sub mnuAddBlock_Click()  
    Dim Block As TrackBlock  
    Set Block = pClickedTrack.AddBlock(False, pX, 50)  
End Sub

See Also

GridHitTestInfo Object


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