Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Disable Chart Scroll just when above a Button

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

    Disable Chart Scroll just when above a Button

    Hello guys,

    I would like to know if there is a way to disable, by code, that ninjatrader 8 goes back on bars when using the mouse wheel. I create a button on chart, that is reacting at the mouse wheel, and making some action, but soon as I place the mouse cursor on the button, it also makes the chart to go back on past bars. and I want to disable that function, only when Im above the button, but not on every other point on the chart.

    I hope I could explain what I need.

    Thank you!

    #2
    Hello facuevasm,

    Yes you can do that by adding the following code to your control:

    Code:
    textBox.PreviewMouseWheel += (o,e) => { if(e.Delta > 0 || e.Delta < 0) e.Handled = true; };
    You can test that code by downloading the following script TestTextBox and using it in the State.Historical logic where the handlers are being subscribed to. You would otherwise replace textBox with the variable of your control in your own script.



    Comment


      #3
      Thank you Jesse! That worked.

      :=)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      71 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X