Announcement

Collapse
No announcement yet.

Passing variables to drawtext & drawline

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

  • Passing variables to drawtext & drawline

    Is it possible to pass a variable describing the line format to the drawline function?

    It seems to work fine when using numbers e.g. the thickness of a line but not for a text base parameter e.g. PS_SOLID or the name of the line or text itself.

    I get the error "Parameter Number 5 of Function drawLineRelative is invalid". I've seen this parameter passed into the main part of the code as a function parameter but my requirement is necessary to change the appearance of a line say from PS_DASH when a target but to PS_SOLID when target is reached.

    I have tried having two different drawline commands within an if statement, one with PS_DASH and one with PS_SOLID but I get half a length of line dashed before the condition was met and half solid after the condition was met but at a different price. Perhaps that is a different coding issue but it would be nice to retain the same code for both and pass a parameter to the function.

    Steve
    Last edited by sajones; 07-15-2007, 12:54 PM.

  • #2
    Steve

    Is it possible to pass a variable describing the line format to the drawline function?
    It is possible by enclosing the variable in an eval() function to evaluate the string (see example enclosed below)
    Alex

    PHP Code:
    var myParameter PS_SOLID;
        
    drawLineRelative(-10,close(0),0,close(0),eval(myParameter),1,Color.red,"line"); 

    Comment

    Working...
    X