Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why is the pen frozen?

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

    Why is the pen frozen?

    Consider the following code:
    Code:
                    line.index = Lines.Length;
                    AddLine(line.color, line.value, line.name);
                    //Lines[line.index].Pen.DashStyle = line.style;
    The code this bit is from works fine, but only because of the commented-out line. If I uncomment the line, it throws because I am trying to write to a read-only property. Looking at it in the debugger, sure enough -- the pen is frozen.

    Why? How an I supposed to set the line style?

    =====

    Related question: how am I supposed to set the plot style for a plot added with AddPlot(...)?

    --EV
    Last edited by ETFVoyageur; 08-08-2015, 01:35 AM.

    #2
    Don't you want to use a Stroke instead?


    Comment


      #3
      Originally posted by sledge View Post
      Don't you want to use a Stroke instead?

      http://ninjatrader.com/support/forum...ght=pen+frozen
      Thanks for the suggestion.

      I do not see that I have that choice, though -- I a trying to set dash style for a Line that is the result of an AddLIne(...) operation. I can see that theLine has a Pen, but I cannot see that it has a Stroke. It does have a StrokeStyle, but that is also read only. I don't see anything writeable that looks as if it takes a dash style.

      --EV
      Last edited by ETFVoyageur; 08-08-2015, 07:34 AM.

      Comment


        #4
        Originally posted by ETFVoyageur View Post
        Thanks for the suggestion.

        I do not see that I have that choice, though -- I a trying to set dash style for a Line that is the result of an AddLIne(...) operation. I can see that theLine has a Pen, but I cannot see that it has a Stroke. It does have a StrokeStyle, but that is also read only. I don't see anything writeable that looks as if it takes a dash style.

        --EV
        Like you do for everything that is frozen. You clone the object, change the properties of the clone and then assign the clone to the old object. You can Freeze() the clone before assigning it if you want, or you can Freeze() the object after it has been assigned.
        Last edited by koganam; 08-08-2015, 10:35 AM.

        Comment


          #5
          Things sure seem easier in the morning. Read your suggestion, kicked myself, and a few minutes later line styles and plot styles were working fine.

          Thanks,
          EV
          Last edited by ETFVoyageur; 08-08-2015, 06:41 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Brevo, Today, 01:45 AM
          0 responses
          4 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          3 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          241 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          384 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          6 views
          0 likes
          Last Post oviejo
          by oviejo
           
          Working...
          X