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

Want to capture SizeChangedEventHandler for Chart Window

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

    Want to capture SizeChangedEventHandler for Chart Window

    any clues?

    ?????.SizeChanged += new SizeChangedEventHandler(Window_SizeChanged);

    WindowState windowState = Application.Current.???????.WindowState;

    hopefully once I get this I can resize ChartTrader when the Chart is maximized...because ChartTrader is not restored to a usable width when it is Maximized from a small window.

    Muchas gracias



    #2
    this is a two step process:

    1) capture the SizeChangedEventHandler event

    2) set the width of ChartTrader with code


    ideas?


    would be really nice if Ninja restored the last Maximized width of Chart Trader and restored it when Maximized again...what do you think Ninja?





    Comment


      #3
      correction

      would be really nice if Ninja remembered the last Maximized width of Chart Trader and restored it when Maximized again...what do you think Ninja?

      Comment


        #4
        ok, this will allow me to set the correct width on a resize....(from SampleWPFModifications script)

        chartGrid = chartWindow.MainTabControl.Parent as Grid;
        chartTraderGrid = (chartWindow.FindFirst("ChartWindowChartTraderCont rol") as ChartTrader).Content as Grid;
        chartTraderGrid.Width = 200;

        now I just need to know when the Window of the Chart is resized....

        !!

        Comment


          #5
          Ok, getting closer...

          can now hook to the resize/maximized event, there I set the ChartTrader width to 200 and it does not do anything

          will post the code and also a video of the issue when I can

          Comment


            #6
            Hello llanqui,

            Thanks for your notes.

            There are no supported NinjaScript-specific methods or functions that would allow you to accomplish this.

            This would require the use of custom C# code to accomplish this. Something you could do is research possible C# code that could be used to detect the state of a window and apply the logic to your script.

            Please let me know if you have further questions.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              yes, see the post just before yours...I have the code now and it is just missing one thing...will post later and see if anyone has a solution

              Comment


                #8
                Ok, I'm able to control the width of the ChartTrader grid...but actually it is not what I need....

                it looks like to me that ChartTrader as a whole is a column in the Chart Window Grid?

                this is working for the Grid inside of ChartTrader
                ================================================== ================================================== =================

                // the main chart window
                chartWindow = System.Windows.Window.GetWindow(ChartControl.Paren t) as Chart;

                // if not added to a chart, do nothing
                if (chartWindow == null)
                return;

                // this is the grid in the chart window
                chartGrid = chartWindow.MainTabControl.Parent as Grid;

                // this is the entire chart trader area grid
                chartTraderGrid = (chartWindow.FindFirst("ChartWindowChartTraderCont rol") as ChartTrader).Content as Grid;

                chartTraderGrid.Width = 200; // I use this also to change the width wider in the SizeChanged event

                // now hook into the resize event
                chartWindow.SizeChanged += new SizeChangedEventHandler(Window_SizeChanged);

                ================================================== ================================================== =======================

                with this I can set the ChartTrader grid width and it works...but that does not change the width of the entire ChartTrader,

                just the container (grid) inside ChartTrader which holds the buttons, listbox, etc


                does what I'm trying to do make sense?

                I want to control the width of ChartTrader, not the grid inside of it...

                If this does not make sense then I'll upload a video

                Comment


                  #9
                  Hello llanqui,

                  Thanks for your note.

                  We do not have any documented or supported code for modifying the width of Chart Trader programmatically and this would go beyond the support we would be able to provide as mentioned in post # 6.

                  That said, this thread will be open for community members to share their insights on unsupported code that might accomplish your goal.

                  Please let me know if I may assist further.
                  Brandon H.NinjaTrader Customer Service

                  Comment


                    #10
                    I'll post a video as to why I need this and then perhaps it would be included in future releases

                    apparently what I need to do it myself is how to address the internal Chart grids,

                    Comment


                      #11
                      I believe that what I need to finish the code is the GridSplitter that is inside the grid of the Chart Window

                      // this is the grid in the chart window
                      chartGrid = chartWindow.MainTabControl.Parent as Grid;

                      if I know the name of the GridSplitter then I can finish the code

                      you have published code on how to access the main chart window components, such as in ChartTraderUIElementsFromAutomationIDsIndicatorExa mple and SampleWPFModifications

                      but what is missing there is how to access the GridSplitter

                      so, I think it is within the scope of your support to be able to provide this??

                      (should I post this request somewhere else?)

                      Comment


                        #12
                        Hello llanqui,

                        Thanks for your notes.

                        Not every element has an Automation ID assigned to it and it would be up to you to use the MSInspect tool to find Automation IDs.

                        Information about this could be seen in the forum thread links below.





                        Note that this is possible using undocumented code, however, since it is undocumented code we would not be able to provide assistance on this matter and it would be up to you to use undocumented code at your discretion.

                        If the GridSplitter does not have an Automation ID, the GridSplitter would likely need to be found by looping through the grid objects.

                        Let me know if I may assist further.
                        Brandon H.NinjaTrader Customer Service

                        Comment


                          #13
                          Ok, well WPF is new to me, so I'm on a learning curve..

                          probably with this advice I can find it

                          thanks

                          Comment


                            #14
                            Looks like that tool may be in Visual Studio, which I do have...

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by RookieTrader, Today, 09:37 AM
                            3 responses
                            15 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by kulwinder73, Today, 10:31 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post kulwinder73  
                            Started by terofs, Yesterday, 04:18 PM
                            1 response
                            23 views
                            0 likes
                            Last Post terofs
                            by terofs
                             
                            Started by CommonWhale, Today, 09:55 AM
                            1 response
                            4 views
                            0 likes
                            Last Post NinjaTrader_Erick  
                            Started by Gerik, Today, 09:40 AM
                            2 responses
                            7 views
                            0 likes
                            Last Post Gerik
                            by Gerik
                             
                            Working...
                            X