Capturing mouse event to select element by click

Add-in Express™ Support Service
That's what is more important than anything else

Capturing mouse event to select element by click
 
Vladimir Lvov




Posts: 6
Joined: 2011-12-16
I need to intercept a click event before any page or element event handler. I want to detect what element would handle the click but prevent any page reaction. That is what IE9 does in "Select Element By Click" mode when you using F12 developer tools.
Thank you,
Vladimir
Posted 16 Dec, 2011 15:25:01 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Vladimir,

To disable the default action of a HTML event you need to set the e.Cancel property to true.
E.g.

private void adxiehtmlDocEvents1_OnClick(object sender, object eventObject, ADXCancelEventArgs e)
{
e.Cancel = true;
}
Posted 19 Dec, 2011 10:37:05 Top
Vladimir Lvov




Posts: 6
Joined: 2011-12-16
Thank you, Sergey,
That code does not work if the document has an element with its own event handler. Element event handlers are called before document level event. It seems the only option is suppressing all element level onclick events from JavaScript.
Posted 20 Dec, 2011 16:05:45 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Vladimir,

For some reason I can't reproduce the issue. What did you set in the SupportedEvents property of the ADXIEHTMLDocEvents component.
Posted 21 Dec, 2011 11:14:57 Top