Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Clicking Draw Objects inside SharpDx rectangle

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

    Clicking Draw Objects inside SharpDx rectangle

    Hi there.

    I've got an indicator that shades the overnight session in a dim grey to make it clear. I use SharpDX FillRectangle to draw the shading.

    I'm finding that draw objects that are within a SharpDX shaded rectangle are very difficult to click on. Sometimes it takes two or three clicks before the draw object is selected - and it requires a lot more precision when to select a drawing object when it is within a SharpDX rectangle.

    I've attached a small spike to show what I mean. The attached indicator shades the entire background of the chart using a SharpDX rectangle. If you add this indicator then draw several lines. and try to select/deselect them repeatedly you will see what I mean.

    Is there any way to current this behaviour?

    Thanks
    Attached Files

    #2
    Hello kevinenergy,

    Just to clarify are you expecting that you can click anywhere in the rectangle to select the object or is the problem that when selecting the anchor it takes multiple clicks?

    Only the anchor price is going to be clickable so if the expectation was to select anywhere in the rectangle that is likely the problem.

    Comment


      #3
      The problem is that when I have manually-drawn objects such as lines/rectangles/channels ettc that are within the bounds of a shaded sharpdx area, the manually-drawn objects often don't respond to clicks (like if I want to select the manually-drawn object in order to modify, move, or delete it). It sometimes takes several click for the draw-object to detect the click and become selected.

      I've tried setting the indicator that shades the background to ZIndex min-value but that doesn't work.

      Its like the draw objects become less-sensitive to clicks when they're within a sharpdx shaded area.

      Comment


        #4
        Hello kevinenergy,

        You may need to implement IsInHitTest in your object. You can look at the other built in drawing objects to see how that is used in OnRender.

        Comment


          #5
          Search for an indicator called "TC_IsOvernight" It does what you want without the selection problems.

          Comment


            #6
            Hey Jesse. I have made a small video that demonstrates the problem. this uses the SharpDxClick spike indicator that I shared above which is a small spike I made for demonstration purposes.

            Comment


              #7
              Hello kevinenergy,

              Yes in this case please try using IsInHitTest, the existing drawing objects implement this and your indicator would need to as well if it makes overlapping renderings. You can use the following before your rendering code:

              Code:
              if(IsInHitTest) return;
              Here is an example of how that is implemented in the region highlight tool:

              Code:
              if (!IsInHitTest && areaBrushDevice.BrushDX != null)
              RenderTarget.FillRectangle(rect, areaBrushDevice.BrushDX);

              Comment


                #8
                That seems to have worked! Thank you!!!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                603 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                349 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                104 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                560 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                560 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X