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 Shansen, 08-30-2019, 10:18 PM
        24 responses
        938 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        3 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by rocketman7, Today, 01:00 AM
        0 responses
        2 views
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Working...
        X