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

subscribing to KeyDown and PreviewKeyDown for the ChartTrader

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

    subscribing to KeyDown and PreviewKeyDown for the ChartTrader

    I can subscribe to these for the Chart main window

    ChartControl.PreviewKeyDown += PreviewKeyDown_Event;
    ChartControl.KeyDown += KeyDown_Event;

    but I don't get the events when the cursor is over the ChartTrader on the right side...

    how do I also subscribe to the KeyDown events when the focus is on the ChartTrader?

    thx​

    #2
    Hello llanqui,

    Thanks for your post.

    We have received your question and are investigating the matter at this time.

    Once we are finished investigating the matter we will update this forum thread with our findings.

    Thanks for your patience.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello llanqui,

      Thanks for your patience.

      To accomplish this you would need to find Chart Trader by its automation ID.

      You could consider finding the Chart Trader area grid and assigning it to a System.Windows.Controls.Grid variable called something like 'chartTraderGrid'. Then you could check if chartTraderGrid is not null and subscribe to the events, such as chartTraderGrid.KeyDown.

      See the following forum post for instructions on finding an automation ID,


      Note that a Dispatcher will have to be used otherwise an error will occur due to the multi-threaded nature of NinjaTrader.

      Attached is a simple script that demonstrates this concept.

      If the script is added to a chart, Chart Trader is enabled, a button in Chart Trader is clicked such as the Close button or Account drop-down menu, and we press the left Ctrl button on the keyboard then we see "Down" print to the NinjaScript Output window.

      ChartControl: https://ninjatrader.com/support/help...artcontrol.htm
      Multi-Threading Consideration for NinjaScript: https://ninjatrader.com/support/helpGuides/nt8/multi-threading.htm​
      Attached Files
      Last edited by NinjaTrader_BrandonH; 02-05-2024, 09:16 AM.
      Brandon H.NinjaTrader Customer Service

      Comment


        #4
        Thank you Brandon!!!

        Comment


          #5
          Ok, I have it working...now.....

          can you tell me the name of the object that contains ChartWindowChartTraderControl?

          I want to control its Width so it doesn't change when I move the chart...

          :-)

          Comment


            #6
            Hello llanqui,

            Thanks for your notes.

            There are no supported means for controlling the width of the Chart Trader window so it does not change when the chart is resized as stated on the forum thread linked below.

            when resizing a Chart Window with ChartTrader visible, the width of the ChartTrader is often forcibly resized to a width that is unusable. I asked in this forum how to keep it a fixed width....but basically was told that resizing the chartrader width, even if to an unusable width, was "normal behavior" so, I asked


            This forum thread will be open for other community members to share their insights on possible unsupported code you could use.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              could you please put this on the wish list?

              should be very easy to implement

              Comment


                #8
                Hello llanqui,

                Thanks for your notes.

                I have submitted your feature request to the Development team so that they may take into consideration adding it in a future NinjaTrader release.

                This request is being tracked under the number SFT-6217.

                As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted on the Release Notes page of the Help Guide.

                Release Notes — https://ninjatrader.com/support/help...ease_notes.htm
                Brandon H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by fx.practic, 10-15-2013, 12:53 AM
                5 responses
                5,404 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by Shai Samuel, 07-02-2022, 02:46 PM
                4 responses
                95 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by DJ888, Yesterday, 10:57 PM
                0 responses
                8 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by MacDad, 02-25-2024, 11:48 PM
                7 responses
                159 views
                0 likes
                Last Post loganjarosz123  
                Started by Belfortbucks, Yesterday, 09:29 PM
                0 responses
                8 views
                0 likes
                Last Post Belfortbucks  
                Working...
                X