Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawingTool with Mouse events.

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

    DrawingTool with Mouse events.

    Hello,
    I'm developing a DrawingTool for NT8 and I need to check when mouse is hovering specific area.
    I tried to subscribe to the ChartPanel.ChartControl mouse events OnStateChange function (Historical, SetDefaults, Configure) but every time ChartPanel was null.

    How to correctly subscribe to ChartPanel.ChartControl events in DrawingTool?

    #2
    Hello yyesyyesyyes,

    In a DrawingTool script, the OnMouseMove() would provide the ChartPanel (which you could assign to a variable for use in other methods).
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello yyesyyesyyes,

      Thank you for your post.

      As noted in the help guide, ChartControl should only be accessed once the state has reached State.Historical:Which event(s) are you subscribing to in your script? I suggest subscribing in State.Historical as well as adding a null reference check similar to this snippet:
      Code:
      else if (State == State.Historical)
      {
           if (ChartControl != null)
                ChartControl.MouseLeftButtonDown += MouseClicked;​
      }
      If you are still experiencing unexpected behavior, please provide a snippet of what you have within OnStateChange so I may better understand and assist you.

      Please let me know if I may be of further assistance.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      41 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      28 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      37 views
      0 likes
      Last Post CarlTrading  
      Working...
      X