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, 03-31-2026, 09:41 PM
        1 response
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        33 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        50 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X