$OPTIMIZE ON
$TYPECHECK ON
$INCLUDE "rapidq.inc"
DECLARE SUB Clicky
DEFINT i = 0, up = False
CREATE Form AS QFORM
CAPTION = "Bouncing Buttons!"
Width = 410
Height = 500
Center
END CREATE
DIM Button(5) AS QBUTTON
FOR i = 1 TO 5
Button(i).PARENT = Form
Button(i).Top = 5
Button(i).Left = (75 * (i - 1)) + (i * 5)
Button(i).OnClick = Clicky
Button(i).CAPTION = "Button &" + STR$(i)
NEXT i
Form.SHOWMODAL
SUB Clicky
DEFINT i = 0, j = 0, a = 0, b = 0, tick = 0
IF(up) THEN
a = 425
b = 6
tick = -1
ELSE
a = 6
b = 425
tick = 1
END IF
FOR i = a TO b STEP tick
FOR j = 1 TO 5
Button(j).Top = i
DOEVENTS
NEXT j
NEXT i
up = NOT(up)
END SUB
|