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 NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X