SetDrawEnv group

Hello,

I have a panel in which the user can set a start and end point for a fitting routine (Igor 6.30). I want to draw lines on the graph to mark these locations to make it easier on the user. However, my code only draws one of the two lines (which ever is listed first).

setdrawenv/w=$graphname linefgc=(0,0,65535)      //blue line to mark end
    controlinfo/w=set_variables Var2
    drawline v_value,0,v_value,1
   
   
    setdrawenv/w=$graphname linefgc=(0,0,0)    //black line to mark start
    controlinfo/w=set_variables Var1
    drawline v_value,0,v_value,1


If I use the same commands in the command window (replacing the variables with constants and specifying the graph name) both lines are drawn. I can't see why it works in the command window but not in my function. I made these to lines part of a group and got the recreation commands using DrawAction. The recreation command includes the code for both lines but only draws one.

Thanks for the help.
I think you have the answer in your question. Try adding the window name to the drawline operation. If it is omitted, the drawline operation will act on the top window. Perhaps, your control panel is the top window at some time during the execution of the code.
jtigor wrote:
I think you have the answer in your question. Try adding the window name to the drawline operation. If it is omitted, the drawline operation will act on the top window. Perhaps, your control panel is the top window at some time during the execution of the code.


I just tried this and it didn't work. Additionally, if the issue were with which window is on top, i would expect it to draw neither line, but it draws one. I also tried using DoWindow/F to bring the graph to the front prior to drawing. This also failed to resolve the issue.

Any other thoughts?
proland wrote:
I just tried this and it didn't work. Additionally, if the issue were with which window is on top, i would expect it to draw neither line, but it draws one.


I agree, that was my thought at the time, but not having the full picture of your code it seemed worth a shot.

Are there any other draw environment statements that precede the first in your example code? I believe that unless you use the "save" keyword, an environment setting will only apply to the next draw command. Maybe you set the x & y coordinates to relative or absolute? This begins to make sense with respect to your comment that the first draw command is executed as expected.

Hope this thought is more beneficial than my first.
jtigor wrote:

Are there any other draw environment statements that precede the first in your example code? I believe that unless you use the "save" keyword, an environment setting will only apply to the next draw command. Maybe you set the x & y coordinates to relative or absolute? This begins to make sense with respect to your comment that the first draw command is executed as expected.


That was it... I was setting ycoord to prel and xcoord to the bottom axis. I copied this command and pasted it prior to the second drawing command it now both lines appear.

Thanks alot.