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

Execution Order of OnWindowRestored and OnWindowCreated

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

    Execution Order of OnWindowRestored and OnWindowCreated

    Hello,

    I'm creating an addon which creates a toggle button on the title bar, and then sets its IsChecked state from the workspace file. I'm having a problem because I'm expecting that the OnWindowCreated executes before the OnWindowRestored, as it discusses in the help file under OnWindowRestored. This allows me to create the button first in OnWindowCreated, and then set the state in OnWindowRestored. However, they seem to be executing in reverse order.

    My code is:


    int TestVariable = 2;

    protected override void OnWindowCreated(Window window)
    {
    TestVariable = 5 * TestVariable;
    if (window.GetType() == typeof(NinjaTrader.Gui.Chart.Chart)) LogMessage ("OnWindowCreated", window, TestVariable.ToString());
    }

    protected override void OnWindowRestored(Window window, XElement element)
    {
    TestVariable = TestVariable * TestVariable;
    if (window.GetType() == typeof(NinjaTrader.Gui.Chart.Chart)) LogMessage ("OnWindowRestored", window, TestVariable.ToString());
    }

    The excerpt from the log file is:

    2019-01-14 16:56:15:937|1|16|56:15 OnWindowRestored 25391661 4
    2019-01-14 16:56:16:802|1|16|56:16 OnWindowCreated 25391661 20

    I expected that the two statements be in opposite order, and that the numbers would be 10 and 100.

    Can you tell me what I may be doing wrong? Thank you.

    #2
    Hello webcharacter,
    Thanks for your post.

    I tested on my end and agree that the output is unexpected. I am looking into this and will let you know when I have more information.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Josh.

      Comment


        #4
        webcharacter,
        Thanks for your patience.

        This issue should be fixed in the release of 8.0.17.0 with the fix/feature ID 13497. Unfortunately I do not have an ETA for when this release will be available, but I assure you it is on the way.

        Please let me know if there is anything else we can do to assist.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Josh, that will work out fine for me. Thanks for your quick response to this! Best regards, Brian

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,290 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          9 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          8 views
          0 likes
          Last Post Option Whisperer  
          Started by halgo_boulder, 04-20-2024, 08:44 AM
          2 responses
          25 views
          0 likes
          Last Post halgo_boulder  
          Working...
          X