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

TabControlManager.SetIsSimulation on AddOn Framework NinjaScript Basic

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

    TabControlManager.SetIsSimulation on AddOn Framework NinjaScript Basic

    Hello Guys,

    I'm trying to include the code:

    HTML Code:
    TabControlManager.SetIsSimulation(tc, true);
    https://ninjatrader.com/support/help...t_overview.htm

    inside the AddOn Framework that is a example posted at https://ninjatrader.com/support/help...t_overview.htm

    but this included code does not change the background color for Sim/Real Accounts.

    Would someone help me?

    Here is the complete code

    HTML Code:
    public AddOnFrameworkWindow()
    		{
    			// set Caption property (not Title), since Title is managed internally to properly combine selected Tab Header and Caption for display in the windows taskbar
    			// This is the name displayed in the top-left of the window
    			Caption = "AddOn Framework";
    
    			// Set the default dimensions of the window
    			Width = 1085;
    			Height = 900;
    
    			// TabControl should be created for window content if tab features are wanted
    			TabControl tc = new TabControl();
    
    			// Attached properties defined in TabControlManager class should be set to achieve tab moving, adding/removing tabs
    			TabControlManager.SetIsMovable(tc, true);
    			TabControlManager.SetCanAddTabs(tc, true);
    			TabControlManager.SetCanRemoveTabs(tc, true);
    			TabControlManager.SetIsSimulation(tc, true);
    
    			// if ability to add new tabs is desired, TabControl has to have attached property "Factory" set.
    			TabControlManager.SetFactory(tc, new AddOnFrameworkWindowFactory());
    			Content = tc;
    
    			/* In order to have link buttons functionality, tab control items must be derived from Tools.NTTabPage
                They can be added using extention method AddNTTabPage(NTTabPage page) */
    			tc.AddNTTabPage(new AddOnFrameworkTab());
    
    			// WorkspaceOptions property must be set
    			Loaded += (o, e) =>
    			{
    				if (WorkspaceOptions == null)
    					WorkspaceOptions = new WorkspaceOptions("AddOnFramework-" + Guid.NewGuid().ToString("N"), this);
    			};
    		}
    Thanks,
    Last edited by Rudmax; 01-26-2018, 11:14 AM.

    #2
    Hello,

    Thank you for the inquiry.

    I tried this on my end and was also unable to see a visible change. I will need to research this to see if anything more is required or if this is just not working as expected. Once I have further information I will reply back here.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello,

      Thank you for the wait.

      It looks like this is working, it is just not in the right place for this usage in the example provided and works differently than I had expected.

      This would need to be implemented by each TabPage derivative you create and used logically based on the account selection events.

      For example, in a tab where you have an account selector, you could implement this in the Loaded event for the Tab page to set a default, along with the selection handler for the account selector to toggle its value.

      The syntax SetIsSimulation(this, true); would simply turn the sim mode on, and SetIsSimulation(this, false); would turn it off.

      Code:
      public class AddOnFrameworkTab : NTTabPage
      {
          public AddOnFrameworkTab()
          {
              Loaded += (o, e) => 
              {
                  TabControlManager.SetIsSimulation(this, true);
              };
          }
      }
      Later with the account selector:

      Code:
      accountSelector.SelectionChanged += (o, args) =>
      {
      	if(accountSelector.SelectedAccount.Name == "Sim101")
      	{
      		TabControlManager.SetIsSimulation(this, true);	
      	} else {
      		TabControlManager.SetIsSimulation(this, false);
      	}
      };

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Jesse, you are awesome!

        Just perfect.

        Thank you so much,

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 09:43 PM
        0 responses
        3 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        36 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X