Clicking a button with the mouse?
Author |
Message |
poomanchunk
|
Posted: Thu Apr 29, 2004 7:00 pm Post subject: Clicking a button with the mouse? |
|
|
Hey, I'm new here. I'm also just in my first year of computer science. I bet you may think I'm dumb, but remember, im a first yearer.
But anyways how do you actually make something where you can click a button or something and it'll move onto the next part. I was playing some trivia games in my class and someone I don't know how a button where you could click it. I never got a chance to ask him how he did it.
Plz could someone tell me how to do this, as I know many people will know how. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Thu Apr 29, 2004 7:05 pm Post subject: (No subject) |
|
|
use mousewhere.
code: |
var x, y, btn : int
drawfillbox (100, 100, 150, 150, green)
loop
mousewhere (x,y,btn)
if x >= 100 and x <= 150 and y >= 100 and y <= 150 and btn = 1 then
buttonclicked := true
end if
end loop
|
buttonclicked, in this case, is just a boolean variable. you can do whatever you want inside the if statement.
understand?
oh, the other way is GUI, but that is the evil route. walk in the light. ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
poomanchunk
|
Posted: Thu Apr 29, 2004 7:21 pm Post subject: (No subject) |
|
|
Ok thx that worked, but how do you continue on with the program. Like when I click the button it just goes white and nothing appears after it. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Apr 29, 2004 7:24 pm Post subject: (No subject) |
|
|
Cervantes wrote: you can do whatever you want inside the if statement.
it might be best to just call a procedure once you determine that the button was clicked |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
poomanchunk
|
Posted: Thu Apr 29, 2004 7:27 pm Post subject: (No subject) |
|
|
Ohh, nvm i get how to do it.
I didn't really know what u meant by the "do whatever in the if statement" but now i know thx!! |
|
|
|
|
![](images/spacer.gif) |
Flashkicks
![](http://www.digital-sat.tv/copperfield67/Avatars/matrix.gif)
|
Posted: Fri Apr 30, 2004 5:32 am Post subject: (No subject) |
|
|
And GUI aint Evil---Its just hard to understand cuz its so hidden in the dark ![Twisted Evil Twisted Evil](images/smiles/icon_twisted.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri Apr 30, 2004 6:09 am Post subject: (No subject) |
|
|
Flashkicks wrote: Its just hard to understand
its not hard to understand, it's just poorly writen and basically a shitty module |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|