Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 - How to add additional toolbars/panels?

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

    NT8 - How to add additional toolbars/panels?

    After several hours of experimenting with System.Windows.Controls, using DockPanels, Grids etc etc I haven't found a satisfactory way of producing:

    1. An additional toolbar that integrates nicely and properly with the UI.
    2. A panel to the right of the chart similar to the Chart Trader.

    I've looked at a few examples from NT7, one such being ToolbarShortcutV1 from the NT forums. It seems quite simple to make a new toolbar using Windows Forms:

    Code:
                ts = new ToolStrip();
                ts.Name = "ts";
                ts.Dock = DockStyle.Left;
                //.........etc etc etc
    Now that we are steering away from Windows Forms and into WPF, what is the best starting point you could recommend to do the above? Would you mind sharing some useful methods for accessing NT8's chart windows, menus, toolbars etc.

    Thank you,

    Sim22.
    Attached Files

    #2
    I have posted a thread here:



    ....as I have not received a response.

    Comment


      #3
      Hello Sim22,

      I am currently working on this.

      There is an AutomationId to capture the tool bar (ChartWindowToolBar) but adding in a new panel or area is taking some work.

      So far, I can get in there, but I'm still working out how to make a nice toolbar.

      The code I have so far can help you get started.

      Code:
      Dispatcher.Invoke((Action)(() =>
      {
      	Chart chartWindow = Window.GetWindow(ChartControl.Parent) as Chart;
      	System.Windows.Controls.ToolBar chartToolBar = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowToolBar") as System.Windows.Controls.ToolBar;
      
      	System.Windows.Controls.Grid parentGrid = chartToolBar.Parent as System.Windows.Controls.Grid;
      	System.Windows.Controls.ToolBar myToolBar = new System.Windows.Controls.ToolBar
      	{
      		Background = Brushes.Blue,
      		Height = 200
      	};
      	chartWindow.MainMenu.Add(myToolBar);
      
      }));
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thanks Chelsea.

        I thought perhaps I had asked within the wrong forum.

        I tried using ChartControl as parent and a toolbar/dockpanel as child to make one within the chart window (just to experiment), but I was having all kinds of formatting issues..... especially if I made a panel to the left of the chart window with a 200 pixel width the right margin of the bars increased by 200 pixels..... so eventually the bars migrated so far to the left they disappeared. From what I understand with researching WPF/Controls vs Forms it all comes down to fitting the children within the parent.....and to do so within a certain order......so I assume ChartControl is a child of ChartWindow........more or less.

        Going forward, which is the best forum for asking NT8 ninjascript questions: NT8 general discussion or the general NT programming forum?

        Cheers,

        Simon.

        Comment


          #5
          Originally posted by Sim22 View Post
          I tried using ChartControl as parent and a toolbar/dockpanel as child to make one within the chart window (just to experiment), but I was having all kinds of formatting issues.
          To add it to the chart area instead of the toolbar, you should be adding it to the UserControlCollection and not the ChartControl as talked about here..

          http://ninjatrader.com/support/forum...ad.php?t=74225





          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Originally posted by NinjaTrader_ChelseaB View Post
            There is an AutomationId to capture the tool bar (ChartWindowToolBar) but adding in a new panel or area is taking some work. So far, I can get in there, but I'm still working out how to make a nice toolbar.
            This is an interesting concept, although it doesn't look like you have any rowdefinitions assigned to the toolbars grid.. I can get it to work by declaring a couple, and setting the row of the toolbar to one and mytoolbar to another.. but this probably is not a good idea, as any other indy would have to do the same thing and possibly override what another has done..

            If you going to allow this.. Create at least one row definition to the toolbar grid, and place the toolbar in it with a defined Height (which I also don't believe is currently done) (at least there seems to be no constant formatting to anything in the toolbar at the moment).. but then there's the problem with the window buttons themselves, as shown in this pic..



            Honestly, ignoring what to do with the window buttons themselves, I still see problems and possible conflicts with this concept as well.. As if I add a row definition and SetRow my toolbar to it say one.. The next guy that comes along adds another row definition and set's his toolbar to one, not knowing if another indy already did that, I would expect they both end up overlapping in the same row (1)..

            In post 69 of this thread



            Brett mentioned you all were working on a way to place a toolbar outside of the chart area, So at the moment, I'm patiently waiting to see what you all come up with before I make a final decision on what and how I'm going to standardize on this process..


            Attached Files
            -=Edge=-
            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

            Comment


              #7
              Hello Edge,

              This is something I am still working on.

              Note that NinjaTrader 8 beta items fall secondary in priority to NinjaTrader 7 inquiries. We will continue to work on these as resources allow.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello Edge, This is something I am still working on. Note that NinjaTrader 8 beta items fall secondary in priority to NinjaTrader 7 inquiries. We will continue to work on these as resources allow.
                I was just trying to share some thoughts and observations to this toolbar in toolbar concept after experimenting a little with your code.. Some things that I thought might be currently lacking/missing in NT's base code, and yet some other thoughts/concerns that could still be obstacles even with that change..

                But no real worries or hurry on my part with buttons/panels/toolbars.. I'm currently using the UserControlCollection for my toolbars, have coded around the issues of possibly sharing the space, and it's more than adequate from both a functional and aesthetically pleasing aspect for me..



                Although I do look forward to possibly placing these outside the chart area sometime in the future (not necessarily in the toolbar itself).. It's currently not something I would say real high on my priority list either..


                Attached Files
                -=Edge=-
                NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                Comment


                  #9
                  Dang Edge thats looking pretty dam good..........cant wait for the update e-mail.

                  Comment


                    #10
                    Hi Guys,

                    So, I definitely think that the preferred way to make a tool bar is to overlay this on the chart tab object the way that Edge has done.

                    This is also how the UserControlCollection will work.
                    http://ninjatrader.com/support/helpG...collection.htm

                    For those, that are wanting to place a toolbar outside of the chart tab object on the chart, I've created an indicator that adds a toolbar by adding a few rows and columns, and adds a custom menu in the new row.

                    Additionally, I'm including a second indicator I've made that adds buttons to the chart trader area in both a new row, and at the bottom to a custom grid.
                    Attached Files
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      A BIG BIG thank you :-)

                      Just some feedback:

                      1. This is a great effort from you for the NT community. The key was knowing the NT syntax going forward........

                      2. The B1.png does not load b/c the file is not included. ??? I just commented it out, but others might be confused as to why it does not load up.

                      3. Upon removing the indicator my chart locks up and I have to Ctrl-Alt_Del NT8.
                      Last edited by Sim22; 12-09-2015, 02:02 AM.

                      Comment


                        #12
                        Hi Sim22,

                        I've noticed that picture resources are not importing with an export and I've let our development know about that.

                        The picture was just meant to show an example of how to add a picture to a button. I've changed it so that this at least does a check first using a try and catch.

                        For now it will require that this picture be manually placed in Documents\NinjaTrader 8\bin\Custom\Indicator.


                        Regarding the freezing. Does this happen every time the indicator is removed? Does this happen if you refresh the chart with F5?
                        Attached Files
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi Chelsea.

                          The freezing.......

                          Okay, so I did some testing. I started NT8, added the toolbar to a chart already populated with indicators.....fine. However upon connecting to Kinetic EOD (possibly any data feed) it froze. So I tried the same thing again but with a new blank chart.... froze. I then tried connecting first and then adding the toolbar....fine.

                          I checked my logs and I found the line:

                          Failed to call OnRender for '.....................': 'The write lock is being released without being held.'

                          This may or may not have anything to do with the toolbar but I would like some ideas what this means all the same

                          If noone else is having this issue I'm sure it's a 'personal issue' I will sort out in time.

                          Thanks again,

                          Simon.

                          Comment


                            #14
                            Hello Sim22,

                            Hmmm, the script I have written does not use OnRender..

                            If you close all workspaces and open a new workspace and new chart with no template applied are you able to reproduce the issue?
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello Sim22,

                              I have updated this script to the correct dispatcher with BeginInvoke in both State.Configure and in State.Terminated. Please let me know if you are getting any freezing with this script.

                              Further, the feature request to allow the import/export of images, sounds, and other resources along with NS files is being tracked with ID# SFT-968.

                              (edited . Also uploaded the updated the ChartTraderCustomButtonsExample.)
                              Attached Files
                              Last edited by NinjaTrader_ChelseaB; 09-21-2016, 11:42 AM.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by cre8able, Today, 03:20 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post cre8able  
                              Started by Fran888, 02-16-2024, 10:48 AM
                              3 responses
                              47 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Started by martin70, 03-24-2023, 04:58 AM
                              15 responses
                              114 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by The_Sec, Today, 02:29 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              2 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X