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

raise mouse hover

I am using a custom cell type implemented with the GridGenericControlCellModel.GridGenericControlCellRenderer. My control is grabbing a lot of mouse events (for reasons that are too boring to go into). BUT I would like to able to cache the most recent MouseEventArgs from the mouse move event in my control and then raise an event when the mouse hovers (caught in the WndProc method override) to the cell renderer which in turn can call RaiseMouseHover for the current cell which _should_ I think show the tooltip. As you can probably guess the tooltip doesn''t show, any ideas?? Or better ways of doing this?? Cheers Colin Code snippets: In my control void XXX::WndProc(System::Windows::Forms::Message %p_message) { __super::WndProc(p_message); if(p_message.Msg ==WM_MOUSEHOVER) { //raise the event... mouseHover(this,cached_mouse_move); } } void ComboMenuStrip::OnMouseMove(System::Windows::Forms::MouseEventArgs^ e) { cached_mouse_move=e; } In the cell renderer: void Renderer::Init() { xxx_control_instance->mouseHover +=gcnew ToolTipEventHandler(this,&yyy::showTooltip); } void yyy::showTooltip(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ event_args) { GridCurrentCell^ curr_cell = this->Grid->CurrentCell; this->RaiseMouseHover(curr_cell->RowIndex,curr_cell->ColIndex,event_args); }

2 Replies

AD Administrator Syncfusion Team June 22, 2006 06:00 PM UTC

Is your goal to show a tooltip? If so, you can probably do this by adding a ToolTip control to your control class and setting its properties directly somewhere. Here is some C# code that does this in a WndProc override. public class MyMonthCalendar : MonthCalendar { private ToolTip tip = new ToolTip(); protected override void WndProc(ref Message m) { base.WndProc (ref m); if(m.Msg == 0x200)// (WM_MOUSEMOVE { if(tip.GetToolTip(this).Length == 0) { tip.SetToolTip(this, "ToolTip"); Console.WriteLine("set"); } } else if(m.Msg == 0x2a3)// (WM_MOUSELEAVE) { tip.RemoveAll(); Console.WriteLine("unset"); } } }


CB Colin Bolton June 23, 2006 07:59 AM UTC

Genius, thanks very much. I was so hung up on getting the cell tooltip to appear via the event that I hadn''t thought of putting a tooltip on the control! Cheers! Colin

Loader.
Live Chat Icon For mobile
Up arrow icon