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

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




PostPosted: Sat Jan 22, 2005 2:08 pm   Post subject: mouse clicking

Do you know the code for clicking my mouse on a START button on the output screen?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat Jan 22, 2005 2:48 pm   Post subject: (No subject)

Check out Mouse.Where. Search the tutorials section for it, for use the Turing Help File.
Use that, in combination with if statements, to check if you've clicked on a button.
Or, you could use Turing's built-in GUI, which sucks. The choice is yours.
-Cervantes
MihaiG




PostPosted: Sat Jan 22, 2005 3:18 pm   Post subject: (No subject)

try this

code:

setscreen ("graphics:max;max")
View.Set ("offscreenonly")
Mouse.ButtonChoose ("multibutton")

var x,y,b : int % x is mouses x position y is mouses y position and b is the button
loop
cls
mousewhere (x,y,b)
put "mouse position is (",x," , ",y,")"
put "The button pressed is ",b,""
View.Update

end loop

that should give you an idea of how the mouse works have fun Smile
basketball4ever




PostPosted: Sat Jan 22, 2005 3:22 pm   Post subject: (No subject)

code:
var x, y, button : int
loop
    drawfillbox (100, 100, 200, 200, 7)
    mousewhere (x, y, button)
    if button = 1 then
        if (x >= 100 and x <= 200) and (y >= 100 and y <= 200) then
            put "YAY"
            exit
        else
            locate(3,1)
            put"Try again"
        end if
    end if
end loop


this might help
Bacchus




PostPosted: Sat Jan 22, 2005 4:18 pm   Post subject: (No subject)

Cervantes wrote:

Or, you could use Turing's built-in GUI, which sucks.

why does the GUI sucks so much? i used it before and it was pretty good. worked well for me cause im not in the least bit creative enouph to make really good non-gui buttons
basketball4ever




PostPosted: Sat Jan 22, 2005 5:21 pm   Post subject: (No subject)

Bacchus wrote:
Cervantes wrote:

Or, you could use Turing's built-in GUI, which sucks.

why does the GUI sucks so much? i used it before and it was pretty good. worked well for me cause im not in the least bit creative enouph to make really good non-gui buttons


I think the problem with GUI.Buttons are that they dont look nice : P very very ugly ... if u want a special designed button dont use gui.... as well... to use GUI.Buttons... you also need getwidgeteventid.... which u also need remember... which is really really nasty...
however... by making your own button... a simple if statement can be used
cool dude




PostPosted: Sat Jan 22, 2005 5:36 pm   Post subject: (No subject)

this should help

code:

var font : int
var click : boolean
var button:int
var x,y : int
font := Font.New ("arial:20")
drawfillbox (100,300,200,350,4)
Font.Draw ("start",110,310,font,7)

click:=false
loop
mousewhere (x,y,button)
if button=1 then
if x >=100 and x<= 200 and y>=300 and y<=350 then
click:=true
put "put watever u wanna do next"
exit
else
put "put watever u wanna do if they clicked somewhere else"
exit
end if
end if
end loop
ste_louis26




PostPosted: Tue Jan 25, 2005 12:58 pm   Post subject: (No subject)

I think theres a certain way to place the GUI and thats why it doesn't work well for me. You could also draw a box and use mouse.where to track if they click in it
here's something that may help you click on your button

code:
var finished :boolean  := false
var rangex, rangey, button : int
         locate (3,1)
                put "Click on this screen."
  procedure display
               drawfillbox(0,100,200, 200, green)
        mousewhere(rangex,rangey,button)
    locate(10,1)
                        put rangex, " ",rangey

        if button = 1 then             
           if (rangex >=0 and rangex <=200) and (rangey >=100 and rangey <= 200) then
                        cls
                        put finished
                        finished := true       
                      end if
end if
                      end display
 
loop                   
 display
        exit when finished     
end loop
     
[/code]
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: