Hi,
Given a custom graph box with background image and handle script, is there a way to prevent the user from accidentally dragging the background image when they miss the handle? The problem I have is that frequently when trying to drag the handle I or another user will miss click and wind up dragging the background image instead. There's no easy way to undo this, Ctrl+Z just rescales the image to its original size (not to the size of the graph box). My question is this: Is there a way to force a background image in a graph box to be un-draggable? Or, failing that, is there a way to capture Ctrl+Z to undo this mis-click? Worst case scenario I can add a button, but its UI clutter I don't want.
Example
img = New Image( "$SAMPLE_IMAGES/tile.jpg" );
scale_factor = 0.5;
curimg_scaled = img;
curimg_scaled << Scale( scale_factor );
{scaled_width, scaled_height} = curimg_scaled << Size;
XX=scaled_width/2;
YY=scaled_height/2;
gb = Graph Box(
<<Add Image(
Image( New Image( curimg_scaled ) ),
Bounds( Left( 0 ), Right( scaled_width ), Top( 0 ), Bottom( scaled_height ) )
),
XName( "X_scaled" ),
XAxis( Min( 0 ), Max( scaled_width ), Increment( 100 ), Show Minor Grid( 0 ), Show Major Grid( 0 ) ),
YName( "Y_scaled" ),
YAxis( Min( scaled_height ), Max( 0 ), Increment( 100 ), Show Minor Grid( 0 ), Show Major Grid( 0 ) ),
Marker Size( 6 ),
Handle(
XX,
YY,
//dragscript -- update position
XX = If(x>scaled_width,scaled_width,x<1,1,x);
YY = If(y>scaled_height,scaled_height,y<1,1,y);,
//mouseupscript -- update profile plots
XX = Round( XX );
YY = Round( YY );
// DO STUFF
txt = Eval Insert( "(X,Y)=(^XX^,^YY^)" );
Print(txt);
tb_xy << Set Text( txt );
);
H Line( YY );
V Line( XX );
);
New Window("Test",V List Box(gb,tb_xy=Text Box("")));
Robert Maltby