Type | Description | |||
X as OLE_XPOS_PIXELS | A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates. -1 indicates the current cursor position. | |||
Y as OLE_YPOS_PIXELS | A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates. -1 indicates the current cursor position. | |||
Event | An Event object from the position or Nothing, if not event found. |
The following VB sample displays the event from the cursor, if any:
Private Sub Schedule1_Click() Dim e As EXSCHEDULELibCtl.Event With Schedule1 Set e = .EventFromPoint(-1, -1) If Not e Is Nothing Then MsgBox e.Start & " " & e.End End If End With End Sub
In VBA/MSAccess, you need to replace the EXSCHEDULELibCtl with EXSCHEDULELib, else you will be prompted for a compiler error: "Can't find project or library".
For instance, you can use the (get_)EventFromPoint(-1,-1) method during the LayoutStartChanging( exScheduleEditEvent) to store the Event object from the cursor to a global member, and when the LayoutEndChanging( exScheduleEditEvent) occurs, you can use the previously stored member to identify the Event being edited like in the following snippet of code:
Private evEdit As Object
Private Sub Schedule1_LayoutStartChanging(ByVal Operation As EXSCHEDULELibCtl.LayoutChangingEnum) If (Operation = exScheduleEditEvent) Then Set evEdit = Schedule1.EventFromPoint(-1, -1) End If End Sub Private Sub Schedule1_LayoutEndChanging(ByVal Operation As EXSCHEDULELibCtl.LayoutChangingEnum) If (Operation = exScheduleEditEvent) Then If Not evEdit Is Nothing Then Debug.Print "Event: " & evEdit.Handle & " has been edited, and the new caption is: " & evEdit.ExtraLabel End If End If End Sub
Most of the UI parts of the control can be accessed through the mouse position as listed: