'Clicking on box example
DIM x AS INTEGER, y AS INTEGER, button AS Integer
Screen 7
WindowTitle "Mouse clicking example"
Color 2,15
cls
For px = 50 To 70
For py = 50 To 70
PSet (px,py), 14
Next
Next
Do
GetMouse x, y,, button
If button = 1 Then
If x>50 And x<70 Then
If y>50 And y<70 Then i = 1
End If
End If
Loop Until i = 1
Print "Press any key..."
Sleep
This is what happens with all DO...LOOP UNTIL elements, it is constantly checking for a certain occourence and uses all the CPU. How do you get around this?
'Clicking on box example
DIM x AS INTEGER, y AS INTEGER, button AS Integer
Screen 7
WindowTitle "Mouse clicking example"
Color 2,15
cls
For px = 50 To 70
For py = 50 To 70
PSet (px,py), 14
Next
Next
Do
GetMouse x, y,, button
If button = 1 Then
If x>50 And x<70 Then
If y>50 And y<70 Then i = 1
End If
End If
Sleep 1
Loop Until i = 1
Print "Press any key..."
Sleep
Try it.. Sleep in FB uses millisecond accuracy, not seconds as in QB..
???! That is not what I'm asking. I know that SLEEP counts in milliseconds in FB, but I want to wait for the user to click on the box. Girls... wadda thay know?
kalc wrote:???! That is not what I'm asking. I know that SLEEP counts in milliseconds in FB, but I want to wait for the user to click on the box. Girls... wadda thay know?
i'd be careful she's libel to take that sword there and
lop your head off...
kalc wrote:???! That is not what I'm asking. I know that SLEEP counts in milliseconds in FB, but I want to wait for the user to click on the box. Girls... wadda thay know?
this is a great way to end up not getting any help at all
'd be careful she's libel to take that sword there
OK, sorry Z!re, just couldn't help stating the obvious. No, seriously, sorry. But there is real iron in there: libel! God damn, so good... I might publish it! < That is kind of irony!
kalc wrote:This is what happens with all DO...LOOP UNTIL elements, it is constantly checking for a certain occourence and uses all the CPU. How do you get around this?
To solve the hogging issue, add the sleep 1
kalc wrote:That is not what I'm asking.
kalc wrote:I want to wait for the user to click on the box
Ok, so hogging isnt a problem then? Fine, your code works just fine, stfu.
Next time, before you even think about bashing me, try what I've said.
OK Z!re, I am very sorry. I thoought you ws just telling me about the diferrences between FB and QB with Sleep. This has solved my problem, and a problem that occurs in so many of my programs. Thank you Z!re