Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create some buttons inside drawing tool?

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

    How to create some buttons inside drawing tool?

    Hi Folks!

    I'm trying to create some buttons or something that when I click on it, does some actions.


    The thing is I'm inside drawing tool and using UserControlCollection.Contains(myGrid) .. to create buttons or grid don't work.

    So I need is when editing the drawing tool a buttons or something appear.


    Thanks,.


    #2
    Hello franjcy,

    Unfortunately, the UserControlCollection is not available to Drawing tool scripts, market analyzer column scripts, superdom column scripts, or other scripts that are not indicators or strategies.

    It would be recommended to use an indicator for this functionality instead.


    That said, if it must be in an indicator, you could render a rectangle at specific coordinates, and check the mouse coordinates from an event handler added to the chartControl.MouseDown event.

    I was testing this some time ago and still have my test script you may find helpful.
    RectToMouseXYTest_NT8.zip
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello franjcy,

      Unfortunately, the UserControlCollection is not available to Drawing tool scripts, market analyzer column scripts, superdom column scripts, or other scripts that are not indicators or strategies.

      It would be recommended to use an indicator for this functionality instead.


      That said, if it must be in an indicator, you could render a rectangle at specific coordinates, and check the mouse coordinates from an event handler added to the chartControl.MouseDown event.

      I was testing this some time ago and still have my test script you may find helpful.
      [ATTACH]n1305881[/ATTACH]
      Thanks for your answer, it's useful.

      Finally, I achieved insert buttons on DrawingTool with a StackPanel, like this:

      Code:
      chartControl.Dispatcher.InvokeAsync(() =>
      {
      try
      {
      var chartWindow = System.Windows.Window.GetWindow(chartControl);
      var mainGrid = chartWindow.Content as Grid;
      
      if (mainGrid != null)
      {
      // Creamos un StackPanel para contener los botones.
      buttonPanel = new StackPanel
      {
      Orientation = Orientation.Vertical,
      HorizontalAlignment = HorizontalAlignment.Left,
      VerticalAlignment = VerticalAlignment.Top
      
      ...
      
      };


      Comment

      Latest Posts

      Collapse

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