Move a DrawRect object with a slider


I have developed this pannel where I extract an energy spectrum out of an hyperspectral cube of images (wih the help of ImageTransform getBeam procedure) by setting the pixel position using sliders. I would like to know if it's possible to dynamically move the small red cube on the "flattened cube" image using the sliders.


It is possible, but not convenient.

There are a couple of ways to do it:

1) Use the Prog Front drawling layer, and erase it and redraw completely every time the slider moves. That's pretty easy and has the drawback that if the drawing layer gets used for something else, you will erase that, too.

2) Use the DrawAction operation and a named group to selectively remove/replace just the drawing element in question. It's sort of difficult to wrap your head around how DrawAction works, but it is the sophisticated way to do this. It allows for more selectivity in complicated drawings that need to be only partly re-drawn.


Another idea is to set the variables to a wave to set the xy locations and then a square marker.


Or another idea is to use a crosshair cursor on the image that the user can drag around.  You would need to program a window hook to read the cursor position and extract the appropriate curve.