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 kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        15 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        59 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        42 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        47 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        38 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X