
-----------------------------------
Space!!!
Tue Dec 28, 2010 11:33 pm

Random numbers in buttons.
-----------------------------------
What is it you are trying to achieve?
i want to have 4 buttons that will display random numbers every time a user runs the program.

What is the problem you are having?
i have no idea how to do this.


Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using
4.11


-----------------------------------
Tony
Tue Dec 28, 2010 11:48 pm

RE:Random numbers in buttons.
-----------------------------------
Be more specific. Do you have no idea about:
 - Drawing? [tdoc]Draw.Box[/tdoc]
 - Clicking? [tdoc]Mouse.Where[/tdoc]
 - Random Numbers? [tdoc]Rand.Int[/tdoc]

-----------------------------------
TokenHerbz
Wed Dec 29, 2010 2:03 am

RE:Random numbers in buttons.
-----------------------------------
BAM tony damn you fast....

but yes,

draw your boxes, if click inside those boses, display random number. end done awesome marks. BAM.

-----------------------------------
Space!!!
Wed Dec 29, 2010 12:26 pm

RE:Random numbers in buttons.
-----------------------------------
mhm but i have to make buttons that already display random numbers; then the user clicks it.

-----------------------------------
TokenHerbz
Wed Dec 29, 2010 2:35 pm

RE:Random numbers in buttons.
-----------------------------------
then do the random generation first. doesn't matter when the user clicks it, your program!.

-----------------------------------
ProgrammingFun
Wed Dec 29, 2010 2:59 pm

RE:Random numbers in buttons.
-----------------------------------
Generate a random number, draw a box, and then use font.draw to write the number inside the box...and use buttonwait or mouse.where to make the "button" clickable....all of this will execute so fast that the user will only see the four buttons

You can do all of the above in a counted loop to create four buttons (with the locations of the drawings incrementing each time)...

-----------------------------------
Space!!!
Sun Jan 02, 2011 11:23 am

RE:Random numbers in buttons.
-----------------------------------
var finished : boolean := false
var X, Y, button : int
proc randNumber
    colorback (brightred)
    locate (5, 16)
    put Rand.Int (0, 100)
    locate (5, 28)
    put Rand.Int (0, 100)
    locate (5, 41)
    put Rand.Int (0, 100)
    locate (5, 53)
    put Rand.Int (0, 100)
end randNumber

proc input
    locate (10, 1)
    mousewhere (X, Y, button)
    if button = 1 then
        if (X >= 100 and X = 300 and Y = 200 and X = 300 and Y = 300 and X = 300 and Y = 400 and X = 300 and Y 