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

Username:   Password: 
 RegisterRegister   
 how do i get my program to recognize input from a mosue?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Neja




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




PostPosted: Wed May 28, 2003 8:11 pm   Post subject: (No 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
Tony




PostPosted: Wed May 28, 2003 8:14 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
krishon




PostPosted: Wed May 28, 2003 8:15 pm   Post subject: (No subject)

that's the one, thx tony
Homer_simpson




PostPosted: Wed May 28, 2003 8:18 pm   Post subject: (No 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...
Neja




PostPosted: Wed May 28, 2003 9:08 pm   Post subject: (No subject)

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

Very Happy
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: