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

Close Multiple tabs option

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

    Close Multiple tabs option

    Hello, i have a question about the

    The Tools options - Confirm on window or tab close

    As part of an indicator i have a window which i use for some settings etc and the class is derived from NTWindow.

    When the above tools option is enable obviously it asks the following

    You are about to close multiple open tabs - are you sure you want to continue

    YES NO

    Depending on user actions in the Dialog window eg OK APPLY CLOSE ... various actions are taken.

    If the user says YES to above all is fine ..

    If they select NO to the 'close multiple open tabs' - i would like to be able to handle this and reset some values and do some reference checking.

    Is there a way for this indicator window derived from NTWindow to be able to override this global setting - as i would prefer this pop up window can be disabled for this indicator created window?

    Or is the setting global and will apply to all windows and tabs in the Ninja session?

    If i cannot overrider it can i handle when NO is selected?

    thanks

    #2
    Hello soulfx,

    Thanks for opening the thread.

    I do not see an easy way you could override the No button in this message box to allow for the behavior you are looking for.

    I have submitted a feature request on your behalf asking that the Close Multiple Tabs message box can attach a handler to the Yes/No buttons.

    The Close Multiple Tabs option is also a global setting that gets applied to all NinjaTrader windows. I will submit another feature request asking for this behavior to be controlled from a property for NTWindows.

    I will update this post with the ticket ID's for these feature requests. These can be noted in the Release Notes page of the version of NinjaTrader that includes the implementation. Keep in mind, feature requests are up to the development team and their priorities to consider implementing.

    Both are being tracked with the ID SFT-2514.

    Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

    Please let me know if I may be of further assistance.
    Last edited by NinjaTrader_Jim; 07-11-2017, 11:54 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello, thanks for the reply and submitting both these feature requests.

      So to confirm - there is nothing i can do when this window pops up and i say NO.

      Im trying to establish where control is returned to and what object references i need to reset when this dialog box comes up. It launches or shows a dialogue box/window - even if i dont have the ability to attach a handler to the No button at this time is there anything i can rely upon?

      Or is it currently that i cannot rely on any context variables or references when No is selected and i remain in my own NTWindow - currently it is triggering object reference errors when NO is selected - given this dialog box is out of my control some guidance on how to workaround this whilst these features may or may not be implemented would be useful
      thanks

      Comment


        #4
        Hello soulfx,

        Thanks for your reply.

        The message box created does not appear to be specific to each window or AddOn. I don't think overriding it to perform a certain operation would be able to perform something in the context of the window that called it. Also, as this is not documented, I am not able provide any direction for using it.

        That said, you might be able to come up with a solution using OnWindowDestroyed(). You can observe with a print in the NinjaScript output window that OnWindowDestroyed() will get called once before the dialog comes up after you click the close button and before you click yes on the dialog box. You could use that instance to drive logic if the AddOn window has not been destroyed, then you can perform your desired operations.



        Please let me know if I can be of further help.
        Last edited by NinjaTrader_Jim; 07-11-2017, 09:12 AM.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello, i am looking into the OnWindowDestroyed() to see if i can work with this in anyway in the interim.

          do you have a tracking ID for these feature requests? I noted someone asked if there was a way to access a list of requests and IDs and votes - it was replied there was not and each person would need to ask via the forum for an update. I alone with various requests and 'bugs' over time have about 20+ alleged feature requests and already i have lost track. There must be a better way to maintain this so customers can enquire as to status - with the emphasis on it is up to development to decide we have no way of knowing the vote count or status ; if similar requests have been made i presume ninjatrader tries to update or merge into a similar request if it functionally makes sense?
          Whilst this may be viewed as an internal ninjatrader prerogative - as i said i'm sure people have lost track of their 'feature requests' / given up that they will ever be implemented etc or just dont know and drop their development if no creative alternative solution can be found. So some transparency on this i believe would be appreciated all round.
          thoughts?
          thanks
          Last edited by soulfx; 07-13-2017, 11:31 AM.

          Comment


            #6
            Hello soulfx,

            As the feature requests were related they were assigned with the single ticket ID SFT-2514.

            While I agree it would be a great idea to group lists of feature requests for our clients, we currently do not have a simple means to aggregate information for any specific client. So we are left with informing our clients of the assigned ticket ID's.

            I will submit your feedback to request a database for client feature requests.

            Your input is being tracked in our feature tracking system with the ticket ID SFT-2530.

            If there is anything else I can do to assist, please let me know.
            Last edited by NinjaTrader_Jim; 07-13-2017, 04:42 PM.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello, thanks for reply.

              In looking at your suggestion of using the OnWindowDestroyed() i am familiar with this in the addon package environment and already use this in a separate unrelated piece.

              The context of where this applies is in a window derived from NTWindow and used within an indicator NOT an addon. I dont see OnWindowDestroyed being available as an override in this situation.

              Additionally - for example the properties of a context menu for a drawing tool does not prompt for confirmation of closing window - and this is with the global setting still set to true. So there are working examples of this being managed already? Can you point to that area of offer some guidance on how that is handled as the same approach would likely apply with what i am trying to achieve
              thanks

              Comment


                #8
                Hello soulfx,

                Yes, the OnWindowDestroyed() override will have to be added to a an AddOn outside of the indicator. You can observe the method gets called for every window close by creating a new blank AddOn with a Print() added to the OnWindowDestroyed() override. This includes the Drawing object and Indicator dialog windows that do not alert the user with a message box.

                After thinking about this further, I don't think it would be possible to work around this by creating a condition in an AddOn that checks if a window still exists after OnWindowDestroyed() occurs. The issue I see is that closing a similar message box from another part of the platform when the window is open would create the same event that we would read as "OnWindowDestroyed() occurred, window still exists; User clicked No."

                As for the drawing properties window not creating a prompt, you might be onto something that is handled like that internally. Unfortunately, I would not be able to provide further direction for usage on anything internal and undocumented. That said, I will add a note to the Feature Request ticket asking if this internal logic is something that could be used externally in the future.

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

                Comment


                  #9
                  Hello Jim, as per my last note this is NOT an addON situation but a window opened via an indicator button ; derived from NTWindow - so lets forget the OnWindowDestroyed aspect here.

                  I am trying to find a work around here ... and am now making additional null reference checks.

                  The _window handle which points to the NTWindow where i am displaying information - gets lost if the No is selected on the prompt - so even if i test for null where i cannot even close the window.

                  So in testing this further as i indicated if the global setting is to false/disabled i dont get these popups. If i leave this to true i get the pop up and it leaves the window in no mans land with no easy means to clean up and this propagates issues on closedown and workspace issues.

                  I am working to devise a better clean UX for other users of what i am working on. On this point i would like to clarify your submitting this as a 'feature request' when it is actually a bug and a shortcoming in the design/architecture? Can you clarify this?

                  You can easily reproduce this is you need to to then submit to development. Some of chelseas button examples of past could create and open an NTWindow with a button to close the window and see what happens.

                  thanks

                  Comment


                    #10
                    Hi soulfx,

                    I understand you are creating a window from an indicator and not an AddOn. OnWindowDestroyed() within any AddOn will get called for any NinjaTrader window aside from the dialog windows as you have pointed out. Regardless, my previous idea for a work around is not valid. So yes, let's leave OnWindowDestroyed() behind.

                    A feature request was submitted for a way to have a window ignore the message box that appears when you close the window (with Confirm on window or tab close enabled.) As the issue is coming from an external NinjaScript outside of the platform, we cannot yet blame the platform for an issue without being certain the implementation is valid.

                    I tested one of Chelsea's examples for creating a window from a button within a strategy, and I don't encounter any issue when I click Yes or No to the confirmation message box when I close the window.

                    Here is the script I tested: http://ninjatrader.com/support/forum...86&postcount=2

                    If you can recreate the issue in this context, let us know. I'd be happy to look it over further to see if we could improve it, or report an internal issue to the development team.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      Hello, i appreciate exploring this further to be clearer on the potential issues here and not yet 'blaming' the platform. Whilst this is a simplistic example in a strategy that does nothing i am contrasting to my code. When the button on menu is pressed it opens a window with two buttons below the information which updates a database with Apply and Close. I disable the NTWindow close X at the top right (so i dont use this .. i did try it and it - not sure what this X close does as i have no control/idea where it goes in termis of cleanup ) and handle the close button with a command delegate. Now this works fine - until the No option is selected in the popup.

                      A question on this for the Tool preferences global setting of enable 'confirm on window or tab close' is there a global variable i can access in my indicator as to the setting of this ? ie true or false - that way perhaps i can use that to prepare is No is selected.

                      The close command associated with my button sets the NTwindow reference to null for this viewmodel and when the control returns after the No and i subsequently try to press the close button - i now capture the fact that window reference in this context is null and so how to close - am looking at storing the window reference elsewhere as a workaround but not liking how i might have to do that.

                      Continuing to look at this and explore this. the binding command in my xaml is correctly binding to the commands i have in place.

                      If you have information on accessing a value for the global setting this would be useful to know in the interim

                      thanks

                      Comment


                        #12
                        Hi soulfx,

                        It looks like you could use Core.Globals.GeneralOptions.ConfirmWindowClose to reference if this option is enabled or disabled.

                        If you have any other questions for me or what we can offer through support, please don't hesitate to ask.
                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          Hello, my idea of using the value of this global to work around this somehow has worked in that i can now 'manage' this .. however i stress this is a workaround and not an ideal coding situation and the feature/fix request below still is very necessary. So for now i can manage/contain this and testing so far looks promising.

                          Jim wrote ...

                          A feature request was submitted for a way to have a window ignore the message box that appears when you close the window (with Confirm on window or tab close enabled.)

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by RubenCazorla, Today, 09:07 AM
                          2 responses
                          13 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by i019945nj, 12-14-2023, 06:41 AM
                          7 responses
                          82 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by timmbbo, 07-05-2023, 10:21 PM
                          4 responses
                          158 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by tkaboris, Today, 08:01 AM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by Lumbeezl, 01-11-2022, 06:50 PM
                          31 responses
                          820 views
                          1 like
                          Last Post NinjaTrader_Adrian  
                          Working...
                          X