0010  // CmlIntuiMessage demo
0020
0030 USE SYSTEM
0040
0050 LOOP
0060   mousebottom(x,y)
0070   PRINT "X = ",x;" Y = ",y
0080 ENDLOOP
0090
0100 PROC mousebottom(REF x,REF y) CLOSED
0110    // Wait until mousebottom pressed and return coordinates
0120   POINTER cmlintmsg@ TO cmlintuimessage@
0130   signo:=comalstruct@.excwinsig!
0140   IF signo=31 THEN  // Bit 31 is difficult!
0150     mask#:=$80000000
0160   ELSE
0170     mask#:=2^signo
0180   ENDIF
0190   REPEAT
0200     REPEAT
0210     UNTIL mask# BITAND comalwait(mask#)<>0
0220     ^cmlintmsg@:=^comalstruct@.cmlintuimessage@
0230     WHILE ^cmlintmsg@<>0 DO
0240       IF cmlintmsg@.class#=8 THEN
0250         x:=cmlintmsg@.mousex%
0260         y:=cmlintmsg@.mousey%
0270         EXIT  // Jump out of WHILE loop
0280       ENDIF
0290       ^cmlintmsg@:=^cmlintmsg@.nextmsg@
0300     ENDWHILE
0310   UNTIL ^cmlintmsg@<>0
0320 ENDPROC mousebottom
