• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 xsgex, Yesterday, 09:46 PM
        0 responses
        2 views
        0 likes
        Last Post xsgex
        by xsgex
         
        Started by Steve L, Yesterday, 09:36 PM
        0 responses
        3 views
        0 likes
        Last Post Steve L
        by Steve L
         
        Started by krugman25, Yesterday, 09:34 PM
        0 responses
        4 views
        0 likes
        Last Post krugman25  
        Started by indy73, Yesterday, 04:42 PM
        0 responses
        15 views
        0 likes
        Last Post indy73
        by indy73
         
        Started by Italianforex, Yesterday, 06:20 AM
        2 responses
        13 views
        0 likes
        Last Post gplatis
        by gplatis
         
        Working...
        X