Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Requirements for OnRender drawing to be selected in panel

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

    Requirements for OnRender drawing to be selected in panel

    Hello,

    Can you tell me what the requirements are to be able to click on and select a custom drawing object in the chart? I ask because, whilst 'allow drag and drop' is enabled, I have one set of drawings drawn via OnRender that I cannot select, and I'm not sure why that stopped working. Other drawings drawn by other indicators on the same chart are selectable, so it is indicator-specific.Can you tell me what the requirements are for this to work?

    Thank you in advance for answering my question.

    For reference, I am using this to get the first selected object, which usually works fine for me in other code.
    HTML Code:
    selected = chartControl.ChartObjects.First(t => t.IsSelected).GetType();

    #2
    Hello pjsmith,

    OnRender items are not clickable because they are just renderings. Drawing objects and other chart objects that are clickable are due to the framework surrounding those items. In an indicator or items that implemented OnRender which do not have those frameworks they will just be visual and not clickable.

    If the data you want to click is the same as plot data you can add plots which will be selectable, those plots don't have to be displayed but will still be selectable if renderings are over them.
    JesseNinjaTrader Customer Service

    Comment


      #3

      Hi,

      Thanks - But I am not quite sure that is correct.

      For instance, I have this volume profile I created. It is entirely drawn in Onrender. It has no traditional plots at all. There is no 'AddPlot' in the code whatsoever. No series are exposed, yet, when I left click the drawing, then right-click on the profile drawing, I get this

      ​​ Click image for larger version  Name:	T9JzuWIPhN.jpg Views:	0 Size:	14.3 KB ID:	1335010
      This I added as I hooked into the ChartControl_ContextMenuOpening and Closing, added my custom menu items, and detected the selected object using the same code I quoted in the prior message. If it returns the name of my indicator as selected, I take action. I think you are saying this would not work unless I had plots. I do not. It still works. Always has. The area I clicked above is entirely drawn in OnRender. Please note - I do have to left click it first, then right click, and I get the menu. This is what is not working on my other indicator as Ninjater does not report any indicator selected when I try this. The clicks are detected correctly. The code I quoted earlier just reports no selected indicator.

      What I am trying to figure out is why. lol. Because it used to work on my 'other' indicator using the same exact methods, yet it does not now. This is why I am asking, specifically, what is Ninjatrader looking for in order for a chartobject to be selectable. It's not a plot in my case on this working one, because there are none.

      Last edited by pjsmith; 02-17-2025, 12:52 PM.

      Comment


        #4
        Hello pjsmith,

        I couldn't comment on what you may have coded to reply there. The default OnRender items don't have any selection ability because its just a rendering. If you have made something which you want the result from you need to copy that and make your other item using the same approach.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by pjsmith View Post
          What I am trying to figure out is why. lol. Because it used to work on my 'other' indicator using the same exact methods, yet it does not now.
          Although I strongly suggest against doing this!
          OnRender Objects are not meant to be selected!

          Beings there no plots to worry about rendering.
          Just Comment out this line in your OnRender().
          Code:
          //base.OnRender(chartControl, chartScale);
          Now Allows Selection, But Also Allows Deletion!!
          (Biggest Issue: Delete Key works when selected!)

          I do not believe NT meant for it to be like this.
          I reported issue in early Beta, and here we are.


          Be Safe in this Crazy World!
          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Thanks, Edge - I do have it working elsewhere though, with just OnRender. Definitely do not have Base.OnRender in that working code. I'll figure it out. I was just hoping for an answer from the people who should know to save me some time. It's a while since I wrote that coded and I honestly could not see what I was missing, or what 'unsupported' way I'd no doubt used to make it work.

            Comment


              #7
              Originally posted by pjsmith View Post
              Thanks, Edge - I do have it working elsewhere though, with just OnRender. Definitely do not have Base.OnRender in that working code.
              The reason why your script that works, works,
              is because it's missing that line in OnRender()
              (which again, is not necessarily a good thing)

              You might recheck your script that doesn't work,
              and make sure that line isn't in that OnRender()

              That line is "Required" if you have "Any" Plots!
              Or you end up Not Rendering Plots All Together!


              Be Safe in this Crazy World!
              -=Edge=-
              NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Schools, Yesterday, 03:32 PM
              1 response
              14 views
              0 likes
              Last Post Schools
              by Schools
               
              Started by Mindset, Today, 09:58 AM
              0 responses
              2 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by michelz, 02-18-2025, 08:30 AM
              17 responses
              326 views
              0 likes
              Last Post Noongun
              by Noongun
               
              Started by llanqui, 03-05-2025, 06:03 AM
              21 responses
              121 views
              0 likes
              Last Post bltdavid  
              Started by kujista, 03-13-2025, 12:41 AM
              8 responses
              45 views
              0 likes
              Last Post kujista
              by kujista
               
              Working...
              X