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

Username:   Password: 
 RegisterRegister   
 mouse function
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mercuryy




PostPosted: Sat May 07, 2005 9:06 pm   Post subject: mouse function

How do you use the mouse-clicking method to proceed from the original screen to the next screen of turing? like a "slide show". like u click on a word which takes you to the next page? i check the turing reference. It gives me something like the Mouse.ButtonChoose but i don't really get it. Can anyone give me a practical example?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sun May 08, 2005 7:44 am   Post subject: (No subject)

For this, you'd probably want to use Mouse.ButtonWait. It's kind of like getch, only for the mouse. The simplest way to link the pictures is to assign a number to each picutre. Each time you click, the number increases by one. The picture associated with that number is always on the screen. This isn't the best way to do it, but it's the simplest (and probably just as good for your purposes) Smile
mercuryy




PostPosted: Sun May 08, 2005 9:56 am   Post subject: (No subject)

Humm. I still don't really get it. i look up the mouse.bottomwait function in the turing reference. and it doesn't really tell me much. Can anyone give me an simple example of how it should be done and i learn from it?

p.s may i suggess someone do a toturial on mouse function? i did a search but i don't think I found anything.
Token




PostPosted: Sun May 08, 2005 9:36 pm   Post subject: (No subject)

here what you would do is add all of your pics into an array. the code is pretty simple, and self explanitory, if you have a question just ask


code:

var x, y, b, next, pic : int := 0

loop
    loop
        mousewhere (x, y, b)
        exit when b = 1

    end loop
    next := 1
    pic += 1
    loop
        mousewhere (x, y, b)
        exit when b = 0


    end loop
    next := 0

%%%%draw pic here
%%somthin like     Pic.Draw (picture (pic), 0, 0, 0)

end loop
mercuryy




PostPosted: Wed May 11, 2005 4:11 pm   Post subject: (No subject)

I tried this
code:

var x, y, b, next, TR : int := 0

loop
    loop
        mousewhere (x, y, b)
        exit when b = 1

    end loop
    next := 1
    TR += 1
    loop
        mousewhere (x, y, b)
        exit when b = 0


    end loop
    next := 0

Pic.Draw (TR, 0, 0, picCopy)
end loop

but for some reason it doesn't work out.
It output an error massage "1 is not a legal identifier"
Token




PostPosted: Wed May 11, 2005 4:26 pm   Post subject: (No subject)

Your problem was that you were using a number in stead of an identifier, so what you had to do was change it so that when you import the pictures you put them into an array, name them pic1, pic2 pic3 ...

code:
var x, y, b, next, TR : int := 0
var marks : array 1 .. 10 of int


for i : 1 .. 10
    pic (i) := Pic.FileNew ("pic", intstr (i) + ".jpg")
end for

loop
    loop
        mousewhere (x, y, b)
        exit when b = 1

    end loop
    next := 1
    TR += 1
    loop
        mousewhere (x, y, b)
        exit when b = 0


    end loop
    next := 0

    Pic.Draw (pic (TR), 0, 0, picCopy)
end loop
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: