• 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

Create a toolbar in a custom NTWindow

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

    Create a toolbar in a custom NTWindow

    How do I add buttons to the header toolbar of a custom NTWindow?

    I've tried putting this in my code, but a and b are both coming back as null, so I don't know how to add items to the top menu.

    Code:
    public class MyWindow : NTWindow, IWorkspacePersistence {
        public MyWindow() {
            Loaded += (o, e) => {
                if (WorkspaceOptions == null) WorkspaceOptions = new WorkspaceOptions("MyWindow-" + Guid.NewGuid().ToString("N"), this);
                var a = this.FindFirst("PART_Menu");
                var b = this.FindName("PART_Menu");
            };
        }
    ...
    }
    If there is a code solution and a resx solution, I'd love to see both.
    Thanks in advance

    #2
    Well, things just got simpler ... when I discovered the "MainMenu" property ... lol, thanks

    Comment


      #3
      I am glad you were able to find a resolution to your query. For reference, here is a relevant section of the help guide.

      http://ninjatrader.com/support/helpG...htsub=MainMenu
      Jessica P.NinjaTrader Customer Service

      Comment


        #4
        Hi there,

        I've added the NT InstrumentSelector to the header toolbar like this:

        public class AddOnFrameworkWindow : NTWindow, IWorkspacePersistence
        {
        public AddOnFrameworkWindow()
        {

        ...

        InstrumentSelector instrumentSelector = new InstrumentSelector();
        MainMenu.Add(instrumentSelector);


        Works fine but how can I attach the private event handler AddOnPage.OnInstrumentChanged to the Instrument selector?

        And I'm curious to know the purpose of InstrumentSelector.LastUsedGroup.

        Many thanks!

        Comment


          #5
          I can imagine two solutions. You as a developer may end up coming up with others
          • Make this a public or protected method instead of a private method.
          • Set up your event handler to remain private, but to also access publicly available members of your class, or passed-in event arguments

          The attached script should help you get started with the second approach. It shows how to set up a custom EventArgs structure, and also shows how to dispatch to another object's thread. In this case the thread used is the main UI thread. However if you review the publicly available MSDN documentation for Dispatcher.Invoke, you should be able to easily dispatch to your class or your instrument selector's threads.


          Code samples we provide are for educational purposes, and are not intended for live trading, and are not guaranteed to accomplish any user goal or to be maintained.
          Attached Files
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            Many thanks for your reply.
            I think I need for both solutions in NTWindow a reference to an instance of my NTTabPage class. Is there a collection or list of NTTabPages in NTWindow available?
            Or how can I reference in my NTTabPage to the parent window container NTWindow ?

            Comment


              #7
              While we do not make this information publicly available, beyond what is in the documentation, generally we do provide some information my colleague Jesse put together which is useful for using the inspect tool to learn more about the platform.

              http://ninjatrader.com/support/forum...44&postcount=7

              Between this and the IntelliSense tool that comes with the editor, you should be able to discover enough in the way of information with any existing NinjaTrader window to be able to hook into its functionality.
              Jessica P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by fxSol, 03-17-2019, 04:17 AM
              3 responses
              22 views
              0 likes
              Last Post NinjaTrader_ChristopherD  
              Started by MarthaClines, Yesterday, 08:06 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Started by Trader_Kim, Yesterday, 03:41 PM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_ChristopherD  
              Started by MarthaClines, Yesterday, 06:23 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by DrDave, Today, 06:42 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_PatrickG  
              Working...
              X