Computer Science Canada

Buttonwait

Author:  Reza [ Mon Jun 06, 2005 8:15 pm ]
Post subject:  Buttonwait

hey,
i have a question about buttonwait,
i was trying to make a procedure or some sort that would keep getting buttonclicks until one of a bunch of places is clicked. I'm not using GUI.
How can i make a procedure to do that.
Thanks

Author:  Cervantes [ Mon Jun 06, 2005 8:59 pm ]
Post subject: 

Are you making your own GUI? Excellent. Smile
To do this, you first do your Mouse.ButtonWait (), then check if the x value returned by that procedure (the mouse procedure) is between the x1 and x2 of your button (or object, whatever it happens to be) and also check if the y value returned by that procedure is between the y1 and y2 of the button/object.
Try writing an if statement that would match what I just said, and post it, so we can tell you if you're on the right track. Smile

Author:  Reza [ Tue Jun 07, 2005 7:25 pm ]
Post subject:  Code

Hey, thanks for ur advice,
so i coded this program, it simply keeps getting clicks until it's right and then it clears screen.

setscreen ("offscreenonly,graphics:200;200")
var x, y, button, buttonNumber, buttonUpDown : int
var finish : int := 0
drawfillbox (10, 10, 100, 100, 1)
View.Update
loop
Mouse.ButtonWait ("up", x, y, buttonNumber, buttonUpDown)
exit when x >= 10 and x <= 100 and y >= 10 and y <= 100
end loop
cls
View.Update


: