Announcement

Collapse
No announcement yet.

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.
        https://ninjatrader.com/support/foru...817#post798817


        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, 04: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 hdge4u, Yesterday, 09:09 PM
              0 responses
              19 views
              0 likes
              Last Post hdge4u
              by hdge4u
               
              Started by hdge4u, Yesterday, 09:02 PM
              0 responses
              10 views
              0 likes
              Last Post hdge4u
              by hdge4u
               
              Started by stormcloudseven, Yesterday, 08:41 PM
              1 response
              11 views
              0 likes
              Last Post DavidTrades  
              Started by GussJ, Yesterday, 01:24 PM
              0 responses
              25 views
              0 likes
              Last Post GussJ
              by GussJ
               
              Started by frslvr, Yesterday, 12:40 PM
              0 responses
              16 views
              0 likes
              Last Post frslvr
              by frslvr
               
              Working...
              X