We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Mousecontroller woes

I'm trying to implement a mouse controller for my grid so I can change the cursor under various circumstances, but I'm having a little trouble. The grid has code in several of the mouse events, and when the mouse controller takes over, the grid's mouse events do not fire. Now, I think it would be relatively simple to fix the problem if I declared the MouseController object in my form WithEvents, then raised events in the mouse controller so that my form could handle them as if the grid itself fired them, but the IMouseController interface does not provide enough methods for that (for example, there is no DoubleClick method). Are there any sort of "best practices" for overcoming this problem? It all seems so complicated just to simply change a cursor.

5 Replies

AD Administrator Syncfusion Team May 11, 2004 11:22 AM UTC

You can also control the cursor by overriding OnSetCursor. Here is a KB that discusses this technique as well as the mousecontroller technique. http://www.syncfusion.com/Support/article.aspx?id=10444 If you want the grid''s other mouse controllers to control the mouse for some point, you can return 0 in your HitTest. But this would also allow them to control the cursor. So, if you just want to control the cursor, then maybe using an OnSetCursor override is the way to go.

DO Don May 11, 2004 11:25 AM UTC

I tried implementing this with the events that the MouseController could handle and I discovered that there are more problems. For one, when I click on a cell and the MouseController takes over, the current cell that was clicked on does not update. Would the MouseController have to do all this stuff (current cell, selections, etc.) manually? If so, yikes...

DO Don May 11, 2004 11:26 AM UTC

I'll check out that OnSetCursor thing. Thanks.

DO Don May 11, 2004 11:45 AM UTC

I don't know if the OnSetCursor solution is much better. I have to derive the grid and, therefore, can't work with it graphically at design-time. Ugh.

AD Administrator Syncfusion Team May 11, 2004 02:33 PM UTC

You can add a derived control to your toolbox if you put it in a class library.

Live Chat Icon For mobile
Up arrow icon