mouse clicking
Author |
Message |
avsrule192002
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
MihaiG
![](http://compsci.ca/v3/uploads/user_avatars/2070081168483773c3dead4.png)
|
Posted: 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 Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
basketball4ever
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Bacchus
![](http://img104.exs.cx/img104/9206/ravenmoon12ns.jpg)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
basketball4ever
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
cool dude
![](http://www.taylorstrategicmarketing.com/images/king.jpg)
|
Posted: 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
|
|
|
|
|
|
![](images/spacer.gif) |
ste_louis26
![](http://img76.imageshack.us/img76/6230/39386pikaitch9er.gif)
|
Posted: 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] |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|