Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddOn Menu question

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

    AddOn Menu question

    Where can I find out about AddOn menu control? I have the existing information / sample that just adds a plain menu entry at the end of an existing Control Center menu. How do I find out about such things as:
    • Controlling where the new item goes in the menu
    • Adding a separator to the menu
    • Adding sub-menus

    A couple of examples:
    • I can add a separator the the Tools menu, but I have been unable to make it look like the other separators. I am guessing I need to set a Style, but I do not now what to set.
    • I want to add a menu entry above "Options...", because that is traditionally the last menu entry. In this case I can figure the index from Items.Count. I do not know how to get the index directly, though, because "Options..." Name property is NULL, and that is what Find() searches on . You can also search on automationID, but I do not know that string.

    I know we are in Beta and I do not expect anything polished, but some writeup, samples, pointer to an old thread answering my questions, or just a good reply in this thread would be very helpful.

    Thanks,
    EV
    Last edited by ETFVoyageur; 08-14-2015, 06:37 AM.

    #2
    Hello ETFVoyageur,

    Thank you for your inquiry.

    The NinjaTrader 8 help guide offers a great guide to start off with the creation of your own add-ons for the platform: http://ninjatrader.com/support/helpG...ng_add_ons.htm

    Here's an example of how you can create a new Separator that has the same style of NT8's menu seperators:
    Code:
    private Separator theSeparator;
    
    theSeparator = new Separator { Style = Application.Current.TryFindResource("MainMenuSeparator") as Style };
    You would be able to add an entry in between the Global Simulation Mode entry and Options entry by using this example code below:
    Code:
    existingMenuItem.Items.Insert(existingMenuItem.Items.Count - 1, myMenuItem);
    The ID for the options menu item is ControlCenterMenuItemToolsOptions.

    More information about using the Insert() method can be found here: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    NinjaTrader_Jesse has created a sample addon that I have linked here that may assist further as well: http://ninjatrader.com/support/forum...5&d=1431447826

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Zachary,

      Thanks for the help.

      My separator is fine now -- I just did not know the correct style to use. Where should I have looked to find the available styles?

      I have not been able to make the ID work, though. I have tried several variants of the following, and all return null. I am continuing to use Count-1, but would really like to know how to use the ID.
      Code:
      DependencyObject optionItem = toolsMenu.FindFirst("ControlCenterMenuItemToolsOptions");
      --EV

      Comment


        #4
        Originally posted by ETFVoyageur View Post
        Zachary,

        Thanks for the help.

        My separator is fine now -- I just did not know the correct style to use. Where should I have looked to find the available styles?

        I have not been able to make the ID work, though. I have tried several variants of the following, and all return null. I am continuing to use Count-1, but would really like to know how to use the ID.
        Code:
        DependencyObject optionItem = toolsMenu.FindFirst("ControlCenterMenuItemToolsOptions");
        --EV
        You might want to look at this for inspiration. Just make sure that it does not cost too much perspiration later.

        ref: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

        Comment


          #5
          Hello ETFVoyageur,

          To determine the AutomationId for the menu or item you are looking to use as an entry point for your Add On you can use Microsoft's Inspect tool: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

          The Inspect tool provides a wealth more information than just the AutomationIds for items.

          koganam also provides a helpful resource that may assist further as well.
          Zachary G.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_ZacharyG View Post

            More information about using the Insert() method can be found here: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

            NinjaTrader_Jesse has created a sample addon that I have linked here that may assist further as well: http://ninjatrader.com/support/forum...5&d=1431447826
            Thank you for this information! I'm still struggling to determine the best approach for what I'm trying to accomplish.

            I'm simply wanting to fire off my method that doesn't require input from the user (similar to how Right-click "copy" or right-click "zoom in" doesn't require user input, but simply initiates an action).

            Are the "add-on" the right starting place to accomplish this? If I right-click on a chart, do we know the entry point name to add to this menu?

            Thanks in advance!

            Comment


              #7
              This sample may help. This shows how to add menu items to the right-click context menu simply by using ChartControl.ContextMenu.Items.

              This sample goes a step further than you are looking for, and it conditionally adds items based on what kind of object may be selected on the chart when right-clicked, but you should be able to extract the simpler concept of adding context menu items.
              Attached Files
              Dave I.NinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AttiM, 02-14-2024, 05:20 PM
              11 responses
              184 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by fernandobr, Today, 09:11 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by timmbbo, Today, 08:59 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by KennyK, 05-29-2017, 02:02 AM
              2 responses
              1,281 views
              0 likes
              Last Post marcus2300  
              Started by itrader46, Today, 09:04 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X