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

Username:   Password: 
 RegisterRegister   
 how do you output the number you click on?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
red1396




PostPosted: Fri Jan 25, 2013 7:27 pm   Post subject: how do you output the number you click on?

so i have an array of random numbers from 1,10. when you run the program these 10 numbers are randomly arranged in a grid. When i click on one of them, how do i make it output, "the number you clicked on was __". I have everything but that. Thanks!
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Fri Jan 25, 2013 8:34 pm   Post subject: RE:how do you output the number you click on?

Break it down. To figure out which number the user clicked on, you need:

1. To detect the click.
2. To figure out which grid cell the click was in.
3. To figure out which number was drawn in that grid cell.

Start by trying to do #1.
red1396




PostPosted: Fri Jan 25, 2013 9:59 pm   Post subject: Re: how do you output the number you click on?

and to detect the click i would need to use the Mouse.Where function and say that if the x and y coordinates are within a certain range and button=0 then it is a click. Right? whats next? How do i go about doing #3?thanks:)
Insectoid




PostPosted: Fri Jan 25, 2013 10:02 pm   Post subject: RE:how do you output the number you click on?

You need to find a way to make each button correspond with a number.
evildaddy911




PostPosted: Sat Jan 26, 2013 9:50 am   Post subject: Re: how do you output the number you click on?

red1396 @ Fri Jan 25, 2013 9:59 pm wrote:
and to detect the click i would need to use the Mouse.Where function and say that if the x and y coordinates are within a certain range and button=0 then it is a click. Right? whats next? How do i go about doing #3?thanks:)


almost. when button = 0 then there was NO click
red1396




PostPosted: Sat Jan 26, 2013 2:36 pm   Post subject: Re: how do you output the number you click on?

ooops yep your right. when button not = 0 then its a click. But HOW do i do step 3? can you please give me some code?
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  [ 6 Posts ]
Jump to:   


Style:  
Search: