Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Call an Event Button?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to Call an Event Button?

    Hi,

    Does anyone know how to call an event button without actually clicking on the button?

    Thanks.

    #2
    Answer posted here.

    Comment


      #3
      Hello kezyclaire,

      There is a sample in the following link, this sample shows finding a window and a specific button also. if you already have a button instance saved to a variable you would only need the few lines in the middle of that sample, closeButton is the variable used for the button in this case:

      Code:
      System.Windows.Automation.Peers.ButtonAutomationPeer peer = new System.Windows.Automation.Peers.ButtonAutomationPeer(closeButton);
      System.Windows.Automation.Provider.IInvokeProvider invokeProv = peer.GetPattern(System.Windows.Automation.Peers.PatternInterface.Invoke) as System.Windows.Automation.Provider.IInvokeProvider ;
      if (invokeProv != null) invokeProv.Invoke();


      This code would be useful if you are clicking a button that is not part of your own script like a button in the platform. If the button is coded in your script its easier to just make a custom method and then have your buttons event call the method. You can then call that method anywhere else when you need to invoke that code.


      https://forum.ninjatrader.com/forum/...rs#post1052911

      Comment


        #4
        This post also has useful information: https://forum.ninjatrader.com/forum/...onclick-method

        Thanks.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X