Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Clicking a button with the mouse?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
poomanchunk




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: 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
poomanchunk




PostPosted: 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.
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
poomanchunk




PostPosted: 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!!
Flashkicks




PostPosted: 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 Laughing Twisted Evil
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: