Announcement

Collapse
No announcement yet.

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.

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X