Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't access MainTabControl.Items parent from NTWindow

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

    Can't access MainTabControl.Items parent from NTWindow

    Hi.

    I'm trying access header tabs from a new window (NTWindow) created by indicator. I tried everything but i could find the correct way.

    Inside the indicator I access tabs bythis way:

    var chartWindow = Window.GetWindow(ChartControl.Parent) as Chart;
    var tabs = chartWindow.MainTabControl.Items;


    But inside addon it cant be accessed​.

    I tried also passing a parameter from indicator chart with actual chart but nothing works. Also with Owner methods.

    #2
    Hi franjcy,

    Please put the code below in the OnStateChange() function:

    Code:
    if (State == State.Historical) {
      if (isCharting) ChartControl.Dispatcher.InvokeAsync(() => {
          var chartWindow = Window.GetWindow(ChartControl.Parent) as Chart;
          var tabs = chartWindow.MainTabControl.Items;
       
          foreach ( TabItem tab in tabs ) {
              Print(tab.Header.ToString());
          }
      });
    }
    Regards,
    William
    ninZa
    NinjaTrader Ecosystem Vendor - ninZa.co

    Comment


      #3
      Originally posted by ninZa View Post
      Hi franjcy,

      Please put the code below in the OnStateChange() function:

      Code:
      if (State == State.Historical) {
      if (isCharting) ChartControl.Dispatcher.InvokeAsync(() => {
      var chartWindow = Window.GetWindow(ChartControl.Parent) as Chart;
      var tabs = chartWindow.MainTabControl.Items;
      
      foreach ( TabItem tab in tabs ) {
      Print(tab.Header.ToString());
      }
      });
      }
      Regards,
      William
      Class of type NTWindow doesn't have OnStateChange() function.

      Comment


        #4
        Hi franjcy,

        We have just created an indicator file. When pressing F5, it displays the NT window, and when pressing the button inside the NT window, it displays the header tabs.

        Please refer to the attached file below.

        Regards,
        William
        Attached Files
        ninZa
        NinjaTrader Ecosystem Vendor - ninZa.co

        Comment


          #5
          Originally posted by ninZa View Post
          Hi franjcy,

          We have just created an indicator file. When pressing F5, it displays the NT window, and when pressing the button inside the NT window, it displays the header tabs.

          Please refer to the attached file below.

          Regards,
          William
          Thanks for your contribution but it doesn't do what I need.
          In your example, you're creating a new tabControl on the NTWindow and then reading the tabs.
          What I need is, from a init window with charts in tabs, open a popup window (NTwindow) with a button and read the previous tabs from indicator was hosted.

          Comment


            #6
            franjcy,

            You need to declare a global variable for the chart so that it can be accessed anywhere in your code. In this example, we used "chartWindow" (line 33). Then, you need to initialize it (see line 73).

            Once initialized, you can use it throughout your code.

            Please refer to the attached file below.
            Attached Files
            ninZa
            NinjaTrader Ecosystem Vendor - ninZa.co

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            579 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X