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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 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
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X