We have a 3rd party control in our project made by SubSystems.com, called the TE Edit Control, also known as "Tern", which is kind of like a word-processor emulator. I've searched through SO for anyone else who's used this control, but it seems like it's not very popular. They do not have any support contact details; they charge anyone who wants help with their product.
Anyway, there's something very wacky happening in the events in their control - specifically the MouseClick and MouseDoubleClick. If there's an image in the document, and you double click on the image, no events get fired. But if you subsequently single-click on the body of the document, suddenly the DoubleClick event of the control fires, instead of the single click event. Looks like the event is getting queued somewhere and waking up at just the wrong time.
I have no intention of wasting my time trying to work out why their control is behaving so weirdly. But I need a workaround for this behavior. Is there any way to make the mouse clicks on this control get transmitted up to the containing control, so I can at least try using a more dependable source for my events?
Any other suggestions on how to catch the click/doubleclick events reliably would be greatly appreciated!
One approach is to add an application level message filter.
You can do this by using the Application.AddMessageFilter(...). The parameter to the call is an instance object that implements the IMessageFilter which is an interface with just a single method called PreFilterMessage. This method is called for each windows message in your application before it is dispatched to the appropriate target. So you can snoop the mouse messages before they are sent to that problem control of yours. That way you can do whatever you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With