On 15/02/2017 at 23:11, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R18
Platform: Windows ;
Language(s) : C++ ;
---------
I am working on a CommandData plugin with dialog and userarea. The userarea will draw items, and when hovering over these with the mouse I draw the items in a different color, suggesting the item being highlighted. I keep the hovered-over item as a member of my derived userarea class, and use this in the DrawMsg method to know what to draw in regular color and what to draw highlighted.
I have noticed that when the mouse cursor is outside of the userarea, no messages are captured in InputEvent or Message methods. Which means that when the user hovers over an item which is at the edge of the userarea and then "quickly" moves the mouse cursor outside of the userarea, no message is send to the userarea to inform that the item is not hovered over anymore. Nor is there any message send to trigger a redraw.
If I remember correctly, I have read in the documentation (somewhere) that there is indeed no possibility to sent a message when mouse leaves userarea as this is not supported cross platform ... or something similar.
I have resolved this by using a timer, polling every 1000ms to check if the current mouse position is still inside of the userarea. When outside I then clear the hovered over item and trigger a redraw, stopping the timer. The timer is thus only active when the mouse is inside the userarea.
However, I am not to fond of using a timer as this means that the timer is continuously running and triggering an event when mouse is inside the userarea. It's only when the mouse is outside of the userarea and the timer has timed out, that the timer gets stopped.
Wondering if there is a better way to detect the mouse leaving the userarea (with or without mousebuttons pressed or keyboard strokes)?
Thanks in advance.