Use the element mouse event as the execution context
A generic COPA-DATA Add-In cannot reliably identify its invoking button from the linked function alone based on the available evidence. Instead, handle the screen element's left-button event. The documented approach identified in the evidence combines WithElementLeftButtonDownEventArgs with IControlElement, allowing the Add-In to inspect the control element associated with the click.
Select the supported event path
| Requirement | Evidence-supported choice | Status |
|---|---|---|
| Identify the clicked button | Handle the element left-button-down event | Supported |
| Represent the clicked control | Use IControlElement
|
Supported |
| Handle left-button-up instead |
ElementLeftButtonUpEventArgs is mentioned only as a requested example |
Implementation not established |
| Read a parent object | Start from the event-associated control element and inspect exposed properties | Exact parent member not established |
Capture and process the clicked control
- Register the Add-In for the screen element's left-button-down event using the API mechanism associated with
WithElementLeftButtonDownEventArgs. - When the event fires, obtain the associated
IControlElementfrom the event context. - Read the properties exposed by that control element and use them to select the generic Add-In behavior.
- Before depending on a parent relationship, verify that the API exposes the required parent property for the returned control element; the evidence does not establish a specific member name.
Verify the event-to-element mapping
Place multiple buttons on the same screen and invoke the Add-In from each one. Confirm that every click supplies the corresponding IControlElement and that the inspected properties change with the selected button. Separately test any left-button-up implementation because the available evidence confirms only the left-button-down approach.
FAQ
How can a COPA-DATA Add-In identify which button was clicked?
Handle the element left-button-down event with WithElementLeftButtonDownEventArgs and obtain the associated IControlElement. Read that element's exposed properties to determine which button invoked the logic.
Can I get the clicked button's parent from IControlElement?
The evidence supports accessing the clicked control through IControlElement, but it does not confirm a specific parent property. Inspect the API members exposed by the returned element before designing logic around a parent reference.
How do I implement ElementLeftButtonUpEventArgs?
The available evidence requests an example but does not provide or confirm an implementation. Use the supported left-button-down event path unless the applicable Add-In API documentation confirms the required button-up event and its element-access mechanism.