Computer Science Canada

Need some assistance

Author:  Dante [ Thu Mar 31, 2011 7:52 pm ]
Post subject:  Need some assistance

I need some assistance, but I don't feel like posting my code here...
So if anyone got some extra time to help me please post back to this thread. =]

Sorry if this is weird, I'm new to this forum.

Author:  huskiesgoaler34 [ Thu Mar 31, 2011 8:04 pm ]
Post subject:  Re: Need some assistance

Okay, how can I help?

Author:  Tony [ Thu Mar 31, 2011 8:13 pm ]
Post subject:  RE:Need some assistance

You don't need to post all the code, just the small part that's relevant. Perhaps not even any code, if you ask your questions well.

Author:  Dante [ Thu Mar 31, 2011 8:18 pm ]
Post subject:  Re: Need some assistance

Well, I'll PM it to you guys, and you guys can kindly have a look at it?
Thanks!

Author:  Tony [ Thu Mar 31, 2011 8:55 pm ]
Post subject:  RE:Need some assistance

I don't typically answer help requests in PMs, but your question was well formed (congrads and thank you). You could have asked it here without posting the code.

Quote:

Basically it's a proc which has the ability to draw a grid.
What my next step is, would be to make a Mouse.Where so that when i click on the grid it shows the row # and the column #.
It would also show -1 if it's not clicking on the grid, or if it so happens to click on a line.

I completely am not sure what to do with the Mouse.Where though. :s
You do not have to give me the answer, maybe just some hints would do.


Turing's documentation for for the command is available at -- Mouse.Where. It will essentially give you the x and y pixel values of where the mouse is (and what state the clicker is in). The tricky part is mapping pixels to rows/columns.

This is perhaps best done through an example: imagine a grid where each cell is 10x10 pixels
column 1: 0-10
column 2: 11-20
column 3: 21-30

if we Mouse.Where tells us we're over pixel 15, how do we figure out that it falls into the range for column 2?

(extra hint: a particularly useful operator is mod)

Author:  Dante [ Thu Mar 31, 2011 10:17 pm ]
Post subject:  Re: RE:Need some assistance

Tony @ Thu Mar 31, 2011 8:55 pm wrote:
I don't typically answer help requests in PMs, but your question was well formed (congrads and thank you). You could have asked it here without posting the code.

Quote:

Basically it's a proc which has the ability to draw a grid.
What my next step is, would be to make a Mouse.Where so that when i click on the grid it shows the row # and the column #.
It would also show -1 if it's not clicking on the grid, or if it so happens to click on a line.

I completely am not sure what to do with the Mouse.Where though. :s
You do not have to give me the answer, maybe just some hints would do.


Turing's documentation for for the command is available at -- Mouse.Where. It will essentially give you the x and y pixel values of where the mouse is (and what state the clicker is in). The tricky part is mapping pixels to rows/columns.

This is perhaps best done through an example: imagine a grid where each cell is 10x10 pixels
column 1: 0-10
column 2: 11-20
column 3: 21-30

if we Mouse.Where tells us we're over pixel 15, how do we figure out that it falls into the range for column 2?

(extra hint: a particularly useful operator is mod)


Thanks! I've almost got this entire thing figured out.
Now just need to figure out a calculation for the exact positions of the lines. Very Happy


: