Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

button click doesn't call InvokeEvent handler

$
0
0

hi

i have to applications A and B.

A is a simple winform application with only a single button on it.

B is my automation application.

i'm hooking up to the InvokePattern.InvokeEvent like this:

public AutomationElement AElement
        {
            get
            {
                return aElement;
            }
            set
            {
                aElement = value;
                AutomationPattern[] patterns = AElement.GetSupportedPatterns();
                if (patterns != null && patterns.FirstOrDefault(p => p == InvokePatternIdentifiers.Pattern) != null)
                {
Automation.AddAutomationEventHandler(InvokePattern.InvokedEvent, AElement, TreeScope.Element, new AutomationEventHandler(AutomationInvokeHandler));
                }
            }
        }
private void AutomationInvokeHandler(object sender, AutomationEventArgs e)
        {
            Trace.WriteLine("button invoked!);
        }

I can't get it to call the handler.

I'v tried clicking the button and tried to invoke it from my automation application. Nothing will call the handler.

Does somebody have an idear on what is going wrong. It's a pretty simple setup so im amazed that it doens't work.


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>