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 CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        61 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        34 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        198 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        364 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        283 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X