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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      596 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      343 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      556 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      554 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X