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

HitTesting - Not sure whats going on

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

    HitTesting - Not sure whats going on

    Hi-

    I have a custom drawing control that draws a custom rectangle; nothing fancy. If I draw its outline, I can then activate it/select it. I gave the custom rectangle a setting to NOT show its outline. When I draw the rectangle but not its outline, I can no longer interact with it on the chart. I cannot select it. If I set it to draw its outline, it works fine.

    Is the framework doing its own hittesting to decide if there is a shape underneath? My rectangles are translucent, but you can see them.

    Thanks,

    Nick.

    #2
    Hello Nick,

    Are errors appearing in the Log tab of the Control Center?

    Is this a property that is being checked in the OnRender() method?

    Specifically, are you asking if the border of a rectangle is transparent if the object cannot be selected?

    Can this reproduced with the Rectangle drawing tool included with NinjaTrader?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea-

      The link below shows a video of what is going on.

      There are no errors in the log. I have a simple bool property I check in the OnRender to decide if I call DrawRectangle or not. As you can see in the video, when the rectangle outline is drawn, I can then select it - I have NO SELECTION logic in my code. That is being done higher up in the framework as far as I can tell. When I run in visual studio, I do not get any OnMouseXXX events. However by adding some text to the end, I can select that and it allows the item to then get the mouse events.

      This does not happen with the Rectangle, even when I set its outline opacity to 0 so it doesnt have an outline. Its definitely a little weird. I couldnt find anything in the help for development that explains how this all works in Ninja. I must be missing something, but I have no idea what.

      Thanks Chelsea,

      Nick.

      Comment


        #4
        Hello Nick,

        What if you set the outline color to Transparent using the Rectangle included with NinjaTrader, is this still unable to reproduce?

        If so, it may be an issue with the custom script you have created.
        (Btw all drawing objects are going to need some logic for selecting anchors)

        You might want to start by pulling the logic for Rectangles into a new script out of the DrawingTools > Shapes file as we know this is not able to reproduce the behavior.

        I've done something similar for the line tool.



        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea-

          Thanks for the feedback; I actually did rip off the rectangle code and modify it. I obviously missed something because the issue definitely doesnt occur with the rectangle. I am finding the documentation isnt very helpful however. Regardless, I have debug print calls and breakpoints set, and when the drawing tool is set to transparent, nothing is firing in my class.

          I will figure it, thanks.


          Nick.

          Comment


            #6
            Maybe as a temp fix you could set the outline pen to an alpha of 1 / opacity 0.01 while you figure out the actual cause.
            Last edited by anon84; 05-13-2019, 05:29 PM.

            Comment


              #7
              Anon84, great idea. That works. With Opacity set to 1, I can now click the region.

              Much appreciated,

              Nick.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rtwave, 04-12-2024, 09:30 AM
              4 responses
              29 views
              0 likes
              Last Post rtwave
              by rtwave
               
              Started by yertle, Yesterday, 08:38 AM
              7 responses
              28 views
              0 likes
              Last Post yertle
              by yertle
               
              Started by bmartz, 03-12-2024, 06:12 AM
              2 responses
              21 views
              0 likes
              Last Post bmartz
              by bmartz
               
              Started by funk10101, Today, 12:02 AM
              0 responses
              6 views
              0 likes
              Last Post funk10101  
              Started by gravdigaz6, Yesterday, 11:40 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X