How to obtain the details of a multi-day spanned appointment based on the position of the mouse hover? ~ Split from F186694

I'm picking this project up and working on getting a custom tooltip control to show/hide for appointment items in the grid. I'm successfully using ScheduleControl.GetItemAtPoint to retrieve the item ID on a mousehover for all single day appointments, but multiday spans do not return an item when using GetItemAtPoint. 

Is there a way to retrieve the IScheduleAppointment of a multiday span with a mouse position?


7 Replies

SG Santhosh Govindasamy Syncfusion Team December 30, 2024 05:18 PM UTC

Hi Steve Stich,

Thank you for reaching out.


Based on the information you provided, your requirement is to obtain the details of multi-day appointments based on the position of the mouse hover.


To proceed further, could you please share how you handled the single-day appointment details using the GetItemAtPoint method in the mouse hover event? If possible, kindly share a code snippet, as it would be helpful for us to move forward.


Thank you for your cooperation, and we look forward to your response.

Regards,
Santhosh.G



SS Steve Stich December 30, 2024 05:38 PM UTC

Here's how I setup the calendar and the handler for GetScheduleHost.CellMouseHover. The CellMouseHover retrieves the item with  HoverItem = MainScheduleControl.GetItemAtPoint(e.MouseEventArgs.Location, HovertItemHitType).


MainScheduleControl = Me.ScheduleControl1

MainScheduleControl.ShowMultiDayAppointmentsAsSpans = True

MainScheduleControl.DataSource = ScheduleDP

AddHandler MainScheduleControl.GetScheduleHost.ShowingAdvancedToolTip, AddressOf MainScheduleControl_ShowingAdvancedToolTip

AddHandler MainScheduleControl.GetScheduleHost.CellMouseHover, AddressOf MainScheduleControl_CellMouseHover

AddHandler MainScheduleControl.GetScheduleHost.CellMouseHoverLeave, AddressOf MainScheduleControl_CellMouseHoverLeave


 Private Sub MainScheduleControl_CellMouseHover(sender As Object, e As GridCellMouseEventArgs)

     Dim HoverItem As IScheduleAppointment

     Dim HoverItemALA As ArrayListAppointment

     Dim HovertItemHitType As ItemHitType

     Dim ToolTipPosition As Point


     'Debug.WriteLine("CellMouseHover e.mouseeventargs.Location: " & e.MouseEventArgs.Location.ToString)

     'Debug.WriteLine("CellMouseHover MainScheduleControl Location: " & MainScheduleControl.Location.ToString)

     'Debug.WriteLine("CellMouseHover GetScheduleHost Location: " & MainScheduleControl.GetScheduleHost().MousePosition.ToString)

     'Debug.WriteLine("CellMouseHover TestPosition: " & TestPosition.ToString)


     HoverItem = MainScheduleControl.GetItemAtPoint(e.MouseEventArgs.Location, HovertItemHitType)

     HoverItemALA = CType(HoverItem, ArrayListAppointment)


     If HoverItem IsNot Nothing Then

         'We have a good item, show the tooltip

         'Debug.WriteLine("HoverItem: " & HoverItem.UniqueID)

         'Debug.WriteLine("Showing CustomToolTip at: " & e.MouseEventArgs.Location.ToString())

         'Debug.WriteLine("Cursor.Position: " & Cursor.Position.ToString())

         'Debug.WriteLine("Position on form: " & CalendarForm.MousePosition.ToString)



         If CalendarForm.ActiveForm IsNot Nothing Then

             ToolTipPosition.X = CalendarForm.MousePosition.X - CalendarForm.ActiveForm.Location.X + 5

             ToolTipPosition.Y = CalendarForm.MousePosition.Y - CalendarForm.ActiveForm.Location.Y - Cursor.Size.Height


             ' Debug.WriteLine("ToolTipPosition: " & ToolTipPosition.ToString)

             If SharedCalendarToolTipItem IsNot Nothing And ToolTipControl IsNot Nothing Then

                 'We have an existing item

                 If SharedCalendarToolTipItem.UniqueID = HoverItem.UniqueID Then

                     'We have the same item, don't change anything but make sure it's visible

                     'Debug.WriteLine("ToolTipItem has not changed, ToolTipControl.Visible = " & ToolTipControl.Visible.ToString)

                     ToolTipControl.Visible = True

                 Else

                     'This is a different item

                     LoadToolTipData(HoverItemALA, ToolTipControl)

                     SharedCalendarToolTipItem = HoverItem

                     ToolTipControl.Location = ToolTipPosition

                     ToolTipControl.Visible = True

                     Debug.WriteLine("ToolTipItem has changed, ToolTipControl.Visible = " & ToolTipControl.Visible.ToString)


                 End If

             Else

                 'We don't have an existing item, create and show the tooltip

                 Debug.WriteLine("Creating CalendarToolTip")

                 ToolTipControl = New CalendarToolTip

                 With ToolTipControl

                     .Name = "myCustomCalendarToolTip"

                     .Location = ToolTipPosition

                     .Visible = True

                     .Width = 219

                     .Height = 280

                 End With

                 'Me.ScheduleControl1.SendToBack()

                 'Me.ScheduleControl1.Controls.Add(ToolTipControl)

                 BeginControlUpdate(ToolTipControl)

                 Me.Controls.Add(ToolTipControl)

                 ToolTipControl.SuspendLayout()

                 ToolTipControl.BringToFront()

                 LoadToolTipData(HoverItemALA, ToolTipControl)

                 EndControlUpdate(ToolTipControl)

                 SharedCalendarToolTipItem = HoverItem

                 Debug.WriteLine("ToolTip Name: " & ToolTipControl.Name)

                 Debug.WriteLine("ToolTip Location: " & ToolTipControl.Location.ToString)

             End If

         End If

     Else

         'We don't have an item, hide and release it

         'CustomCalendarToolTip.Visible = False

         If ToolTipControl IsNot Nothing Then

             Debug.WriteLine("ToolTip Name: " & ToolTipControl.Name)

             Debug.WriteLine("ToolTip Location: " & ToolTipControl.Location.ToString)

             Debug.WriteLine("Removing CalendarToolTip")

             'ToolTipControl.Visible = True

             Me.Controls.Remove(ToolTipControl)

             ToolTipControl.Dispose()

             ToolTipControl = Nothing

             If SharedCalendarToolTipItem IsNot Nothing Then

                 SharedCalendarToolTipItem = Nothing

             End If

         End If


     End If



 End Sub



MS Malini Selvarasu Syncfusion Team December 31, 2024 02:13 PM UTC

Hi Steve Stich,

Thank you for sharing the code snippet. We have replicated the issue where the GetItemAtPoint() method does not return the correct item when defining multi-day appointments. We require additional time to validate the issue and will provide further details by January 03, 2025. We appreciate your patience during this process.


Regards,
Malini Selvarasu


SG Santhosh Govindasamy Syncfusion Team January 3, 2025 03:57 PM UTC

Hi Steve Stich

We apologize for the inconvenience, but we need to examine the issue at the source level. Consequently, we will need some time to validate it and will provide an update on or before January 07, 2025.


Regards,
Santhosh.G



SG Santhosh Govindasamy Syncfusion Team January 7, 2025 01:27 PM UTC

HI Steve Stich,

We have checked the reported issue "GetItemAtPoint does not return the correct value when the mouse hovers over a multi-day spanned appointment " on our end and it is confirmed as a defect. And We have logged a bug. We will fix this issue and include it in our NuGet release Which is scheduled on February 04, 2025.


You can track the status of this report through the following feedback link,

Feedback Link:  GetItemAtPoint does not return the correct value when the mouse hovers over a multi-day spanned appointment in WinForms | Feedback Portal  

Note: The provided feedback link is private, and you need to login to view this feedback.

We appreciate your patience until then.

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

Regards,
Santhosh.G





SG Santhosh Govindasamy Syncfusion Team February 4, 2025 11:58 AM UTC

Hi Steve Stich,

We apologize for the inconvenience caused. The reported issue has been fixed, and we are currently conducting additional tests to ensure its stability. The fix is scheduled to be included in our upcoming NuGet release on February 11, 2025. We will provide you with an update once it is released.

Thank you for your patience and understanding.

Regards,
Santhosh.G




SG Santhosh Govindasamy Syncfusion Team February 11, 2025 01:38 PM UTC

Hi Steve Stich,

We would like to let you know that Essential Studio Weekly NuGet packages (v28.2.5) has been published in nuget.org with the fix for the issue GetItemAtPoint does not return the correct value when the mouse hovers over a multi-day spanned appointment”. Please let us know if you have any concerns in this.

Root Cause Details

We have missed to ensure this when we provide support for Mouse interactions for multi-day spanned appointments. We have modified the X and Y values to consider for multi-day spanned appointments as well. Hence, the issue is resolved.

Regards,
Santhosh.G


Loader.
Up arrow icon