Rem ************************************ Rem * AMOS Example 6.3 * Rem * Rubber banding * Rem * (c) Mandarin / Jawx 1990 * Rem ************************************ Rem Rem Main loop Do GROWBOX Locate 0,0 : Print "Starting coordinates are",GX1;" ";GY1;" "; Locate 0,1 : Print "Ending coordinates are",GX2;" ";GY2;" "; Loop Procedure GROWBOX Rem A simple procedure to create a rubber banding effect Rem Define coordinates as GLOBAL Shared GX1,GX2,GY1,GY2 Rem Set up XOR mode Gr Writing 2 Rem Rubber band Repeat Rem Wait until the left mouse button is pressed If Mouse Key=1 Rem Get coordinates of top corner GX1=X Screen(X Mouse) : GY1=Y Screen(Y Mouse) : GX2=GX1 : GY2=GY1 While Mouse Key=1 Rem Drag box around with the mouse Box GX1,GY1 To GX2,GY2 GX2=X Screen(X Mouse) : GY2=Y Screen(Y Mouse) Box GX1,GY1 To GX2,GY2 Wend Box GX1,GY1 To GX2,GY2 : GRABBED=True Rem Make GX1,GY1 the coords of the TOP left corner If GX1>GX2 : T=GX1 : GX1=GX2 : GX2=T : End If If GY1>GY2 : T=GY1 : GY1=GY2 : GY2=T : End If End If Rem Wait until mouse button is released Until GRABBED Rem Restore writing mode to normal Gr Writing 1 End Proc