Focus problems...
-
I have a Windows Form component that responds to the mouse wheel. On my test form it is the only control and works great, but in my application I have a browser control and serveral instances of that control. In this situation the control never responds to the scroll messages. I have tried setting the focus to it when the mouse enters and all sorts of other things. Any suggestions? BTW, I'm betting James knows. ;P Joshua Guy
Sonork ID: 100.9944 ICQ: 519642 Hotmail: JoshuaJGuy@hotmail.com
-
I have a Windows Form component that responds to the mouse wheel. On my test form it is the only control and works great, but in my application I have a browser control and serveral instances of that control. In this situation the control never responds to the scroll messages. I have tried setting the focus to it when the mouse enters and all sorts of other things. Any suggestions? BTW, I'm betting James knows. ;P Joshua Guy
Sonork ID: 100.9944 ICQ: 519642 Hotmail: JoshuaJGuy@hotmail.com
Joshua Guy wrote: BTW, I'm betting James knows. Off the top of my head... in Form_Load
Application.AddMessageFilter(myComponent as IMessageFilter);
in your componentpublic class MyComponent : ......, IMessageFilter
{
......bool IMessageFilter.PreFilterMessage(ref Message m)
{
if( m.Msg == 0x020A )
{
m.HWnd = this.Handle; // Just in case it checks the HWnd :)
WndProc(ref m); // Let it dispatch the mouse wheel events to your control
return true;
}return false;
}
}Hopfully that'll work, I haven't tested it :) James Simplicity Rules!