Computer Science Canada

how do i get my program to recognize input from a mosue?

Author:  Neja [ Wed May 28, 2003 8:04 pm ]
Post subject:  how do i get my program to recognize input from a mosue?

Meaining, how do i make a sub program appear when the user clicks on the text ie) Click HERE to start

????
Stupid question, I know.

Author:  krishon [ Wed May 28, 2003 8:11 pm ]
Post subject: 

well i dunno if u can clikc on the word, the mods can verify that, but u can draw a box. then u use a command (that i forgot) that can track the location of the mouse. Once the mouse clicks inside the box, and u have an if statement that checks if the moouse click is inside the box, then it'll probably work

Author:  Tony [ Wed May 28, 2003 8:14 pm ]
Post subject: 

Mouse.Where(x,y,b)

it assigns mouse position to variables x and y. B tells you if it was clicked or not.

you check if mouse locations is inside the rectangle boundy and if button is also clicked (b=1) then it was pressed and you shoudl continue.

Author:  krishon [ Wed May 28, 2003 8:15 pm ]
Post subject: 

that's the one, thx tony

Author:  Homer_simpson [ Wed May 28, 2003 8:18 pm ]
Post subject: 

i think this is what u want
code:
var mx, my, mb : int
var col : int
locate (10, 10)
color (9)
put "click here to start"
loop
    mousewhere (mx, my, mb)
    if mb not= 0 then
        if whatdotcolor (mx, my) not= white then
            var winID := Window.Open ("position:top;center,graphics:200;200")
            cls
            put "you just started it"
            exit
        end if
    end if
    if whatdotcolor (mx, my) not= white then
        color (12)
    else
        color (9)
    end if
    locate (10, 10)
    put "click here to start"
    delay (5)

end loop

this one uses text collision detection so u have to be exactly on the letters for it to work...

Author:  Neja [ Wed May 28, 2003 9:08 pm ]
Post subject: 

Hmm, yeah, thanks. i think that's the one.

Very Happy


: