Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Place a button at X and Y coordinates on ChartControl

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

    Place a button at X and Y coordinates on ChartControl

    Hi,

    I am developing an indicator that needs to place a button on the ChartControl (not in the toolbar) at specific X and Y coordinates. I already have the correct X and Y and it would help if I could get to the Canvas that hosts the ChartControl because then I can use Canvas.SetTop and Canvas.SetLeft, just cannot seem to get to the Canvas.

    Could you please direct me to a way to do this even if it is unsupported?

    Thanks,
    John

    #2
    Hello John,

    I would not be able to assist in providing the canvas which is not supported to do by NinjaTrader Support. (I don't think a canvas is used for SharpDX, but I may be incorrect about this)

    However, you can render items and detect the x and y coordinates. Below is a link to an example of this.


    You can use the UserControlCollection to add a grid and control where items appear using the wpf grid. Below is a link to an example of this.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply Chelsea.

      I was looking specifically for a button to just be able to handle the click event on it. I was trying to avoid implementing the code for detecting mouse clicks and hovers etc. on custom drawn objects.

      Comment


        #4
        Hello John,

        Then add the button to the UserControlCollection as demonstrated in the 'NT 8 - LONG SHORT Toolbar Buttons' example I have linked in my previous post.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the feedback Chelsea

          Comment


            #6
            And is there any way to set exact (x, y) location for Grid and for other controls, added to UserControlCollection ?
            fx.practic
            NinjaTrader Ecosystem Vendor - fx.practic

            Comment


              #7
              Hello fx.practic,

              The UserControlCollection takes up the entire chart control area and is WPF. This is not SharpDX.

              The position of objects in here is controlled with normal wpf. Meaning you can add a grid and control the widths of the rows and columns. You can set margin and padding of objects.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by MarianApalaghiei, Today, 10:49 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by love2code2trade, Yesterday, 01:45 PM
              4 responses
              28 views
              0 likes
              Last Post love2code2trade  
              Started by funk10101, Today, 09:43 PM
              0 responses
              8 views
              0 likes
              Last Post funk10101  
              Started by pkefal, 04-11-2024, 07:39 AM
              11 responses
              37 views
              0 likes
              Last Post jeronymite  
              Started by bill2023, Yesterday, 08:51 AM
              8 responses
              46 views
              0 likes
              Last Post bill2023  
              Working...
              X