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 TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              542 views
              0 likes
              Last Post PaulMohn  
              Started by GLFX005, Today, 03:23 AM
              0 responses
              3 views
              0 likes
              Last Post GLFX005
              by GLFX005
               
              Started by XXtrader, Yesterday, 11:30 PM
              2 responses
              11 views
              0 likes
              Last Post XXtrader  
              Started by Waxavi, Today, 02:10 AM
              0 responses
              7 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by TradeForge, Today, 02:09 AM
              0 responses
              14 views
              0 likes
              Last Post TradeForge  
              Working...
              X