Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any way to access the unique ID (identifier) of chart window?

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

    Any way to access the unique ID (identifier) of chart window?

    In NT7 i remember i used a property like ChartHandleId or whatever, so, I saved each chart's identified in c# dictionary.
    What is the alternative in NT8 ? lets say, I want to get the unqinue identifiers for each opened charts and then save some values along with those identifiers in dictionaries.

    I tried this:
    ChartPanel.GetHashCode().ToString()

    but it still give different identifiers from two indicators attached (on different panels) on same chart

    #2
    Found them myself. These seems to be some kind of identifiers, unique for windows (with multiple indicators/sub-charts in them):


    Code:
    ChartControl.OwnerChart.Form.Handle); //same as: ChartControl.OwnerChart.Form.Handle.GetHashCode();
    ChartControl.OwnerChart.GetHashCode()
    ChartControl.Parent.GetHashCode()
    these were not usable for me:

    Code:
    Owner --- null
    ChartPanel.Parent -- ChartControl object
    ChartControl.OwnerChart.Name --- calling thread cant access this
    ChartControl.OwnerChart.TabIndex --- calling thread cant access this
    ChartControl.OwnerChart.Tag --- calling thread cant access this
    ChartControl.OwnerChart.Uid ---calling thread cant access this
    ChartControl.OwnerChart.Parent --> NULL
    ChartControl.OwnerChart.Owner --calling thread cant access this
    Last edited by ttodua; 08-26-2019, 01:19 PM.

    Comment


      #3
      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)
      {string Identifier = "";
      Chart chartWindow = Window.GetWindow(ChartControl.Parent) as Chart;
      chartWindow.Dispatcher.Invoke((Action)(() => {if (IdType == IdTw.Tab)
      {TabItem t = chartWindow.MainTabControl.SelectedItem as TabItem;
      ChartTab TabMe = t.Content as ChartTab;
      Identifier = TabMe.PersistenceId;}
      if (IdType == IdTw.Window)
      {IWorkspacePersistence winPer = chartWindow as IWorkspacePersistence;
      Identifier = winPer.WorkspaceOptions.PersistenceId;}}));
      
      return Identifier;
        }
      Last edited by Bidder; 10-30-2024, 04:43 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      89 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      144 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      83 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      257 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      335 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X