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

Shortcut Key Functionality for Addons

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

    Shortcut Key Functionality for Addons

    I followed the help guide to create menu items for addons. How do I set it up so that shortcut keys can be optionally assigned to those menu items?

    #2
    Hello ntbone,

    Thank you for the post.

    Currently there is no framework exposed for NinjaScript to manage hotkeys so in this situation you would need to use the preview key events to monitor key events and then handle the events you needed. Preview key events are not a NinjaScript concept so this is not something we have a sample or documentation for, you can research this topic on MSDN in contrast to WPF controls. You can also find a sample that was uploaded to the forum of a text box that handles key events which would be a similar process to what you would need: https://ninjatrader.com/support/foru...PreviewKeyDown
    Depending on where you wanted this code to be executed you would need to subscript to that controls preview key events to observe key events when that control is in focus.

    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      So custom drawing tools can have short cut keys because your code generates the menu items but short cut keys for menu items we add cannot take advantage of the shortcut framework you already put in place?

      Comment


        #4
        Hello ntbone,

        You have understood correctly, the hotkey manager has logic to look for drawing objects so they can have hotkeys added like the existing drawing objects. The hotkey manager was otherwise not exposed for NinjaScript use so other types which are not specifically drawing objects wont be able to take advantage of that. You can use the preview key events from other types to capture keys but the existing hotkey manager has no supported solutions for adding custom hotkeys right now.


        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by JTizz, Today, 03:32 PM
        1 response
        33 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by ebaydan777, Today, 02:41 PM
        1 response
        27 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by aligator, Today, 02:28 PM
        1 response
        27 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by daniel_weber8, Today, 01:21 PM
        1 response
        43 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by jungsoohuh, Today, 12:07 PM
        1 response
        35 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Working...
        X