adxiehtmlDocEvents1_OnFocus - eventObject is Null

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

adxiehtmlDocEvents1_OnFocus - eventObject is Null
 
Ben Cowling




Posts: 18
Joined: 2010-10-25
Hi

I'm trying to detect when an input (text) control has focus and looses focus. I can hook into the OnFocus/OnFocusOut events and they get fired but the eventObject is always NULL so I don't know the control associated with it. This is the event handler I'm using.

private void adxiehtmlDocEvents1_OnFocus(object sender, object eventObject)
{
mshtml.IHTMLEventObj2 evtObj = (mshtml.IHTMLEventObj2)eventObject;
}


Regards

Ben
Posted 15 Nov, 2013 11:38:51 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Ben,

Please try the code below:


        private void adxiehtmlDocEvents1_OnFocus(object sender, object eventObject)
        {
            try
            {
                if (HTMLDocument.activeElement != null)
                {
                }
            }
            catch (Exception)
            {
            }
        }
Posted 19 Nov, 2013 03:31:23 Top