How do you make a box shaped trace appear, and stay, closed

I want to create two waves of data (XPixelLocation, YPixelLocation) to create a trace on an image that is four sided polygon, that appears and remains "closed". These waves need five points each (I think), where point 0 and 4 have the same values of X and Y (always). Now I want to edit the wave points (preferably by using GraphWaveEdit) by clicking on the vertices of the polygon (when I do this, the first and last point don't remain together, resulting in an "open" polygon). How do I get xPixelLocation[4] (and Y[4]) to be dependent on XPixelLocation[0] (and Y[0]). It appears I can't make single positions in a wave dependent. Can someone point me in the write direction.
The trick is to use a dummy object on the left side of the dependency, such as a numeric variable:

Variable Num := CheckEndpoint(wbox_y)

The dependency function ensures that the first & last points of the box wave are the same:

Function CheckEndpoint(wbox_y)
    Wave wbox_y
   
    Wave wbox_x

        wbox_y[4] = wbox_y[0]
        wbox_x[4] = wbox_x[0]
End


This works for me in IP7. It should also work in IP6
Hi JT,

Thanks so much, that solved my problem. I made one modification for my conditions.

variable num:=checkendpoint(wbox_y,wbox_x)

function checkendpoint(wbox_y,wbox_x)
    wave wbox_y
    wave wbox_x
    wbox_Y[4]=wbox_y[0]
    wbox_x[4]=wbox_x[0]
end