Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Window/Tab Ids

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

    Window/Tab Ids

    I am trying to find and use a unique id for each window and tab. I did not see anything in the doc, and only found PersistId, but that is only an int and marked depreciated.

    I did find this old thread from the Beta: https://ninjatrader.com/support/foru...ad.php?t=81737 which talks about tracking id NTEIGHT-9319

    Can you please point me to an example that shows how to get the unique id for each window and each tab within the window?

    Thanks.


    Edit: I did find the PersistenceId on the ChartTab, but still looking for similar on Window.
    Last edited by aslane; 07-07-2018, 01:05 PM.

    #2
    Hello aslane,

    Thank you for your note.

    This would not be supported however I will submit a feature request on your behalf.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      So there is no way to access the persistence id of a window? Isn't it stored as an attribute somewhere?

      Comment


        #4
        Hello aslane,

        I'm waiting to hear back on this and will follow up when I have more information.

        Thank you for your patience.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hello aslane,

          The attached unsupported sample would print to the output window a unique ID for each window.

          Please let us know if you need further assistance.
          Attached Files
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            Perfect, thank you.

            Comment


              #7
              Get tab or window id

              In an indicator call from State.configure. Will return either the window or tab guid.

              Code:
              public enum IdTw {Tab,Window}
              
              protected string GetChartId(IdTw IdType)
              {[INDENT]string Identifier = "";
              Chart chartWindow = Window.GetWindow(ChartControl.Parent) as Chart;
              chartWindow.Dispatcher.Invoke((Action)(() => {[/INDENT][INDENT=2]if (IdType == IdTw.Tab)
              {[/INDENT][INDENT=3]TabItem t = chartWindow.MainTabControl.SelectedItem as TabItem;
              ChartTab TabMe = t.Content as ChartTab;
              Identifier = TabMe.PersistenceId;[/INDENT][INDENT=2]}
              if (IdType == IdTw.Window)
              {[/INDENT][INDENT=3]IWorkspacePersistence winPer = chartWindow as IWorkspacePersistence;
              Identifier = winPer.WorkspaceOptions.PersistenceId;[/INDENT][INDENT=2]}[/INDENT][INDENT]}));
              
              return Identifier;[/INDENT]
               }

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              2 views
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,266 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X