Computer Science Canada

turing buttons

Author:  athanasia101 [ Fri May 07, 2010 4:08 pm ]
Post subject:  turing buttons

How do you make buttons on turing.
I need to know how to make a box or a circle and for it to be able to be clicked on by the user Very Happy Very Happy

Author:  DemonWasp [ Fri May 07, 2010 4:24 pm ]
Post subject:  RE:turing buttons

If you mean a traditional button object (like you see in pretty well every application ever), then you need to use GUI.CreateButton or similar. Look in the Turing help files or the Turing Tutorials section for examples.

Otherwise, you can use Mouse.Where() and your own objects (possibly a hierarchy of Shapes, such as Circle and Triangle and Rectangle objects) to determine which objects are clicked on. This is much more involved, but can be much more flexible.

Author:  hamid14 [ Sat May 08, 2010 11:08 am ]
Post subject:  Re: turing buttons

Turing's default GUI sucks and is the worst I have ever seen. I strongly suggest making your own buttons useing a box, oval, etc. Box is really easy with mousewhere. Have a look:

Quote:

%Simple rollover button in turing
%Variables for the mouse
var x,y,button : int

%The main loop
loop
mousewhere (x,y,button)
%unclicked button
if x < 100 or x > 200 or y > 200 or y < 100 then
drawfillbox (100,100,200,200,12)
elsif x >= 100 and x <= 200 and y >= 100 and y <= 200 then
drawfillbox (100,100,200,200,9)
elsif button = 1 and x >= 100 and x <= 200 and y >= 100 and y <= 200 then
drawfillbox (100,100,200,200,42)
%Other events you would want to occur after you click on the button would go here!
end if
end loop


Hope that helped. Very Happy

Author:  SNIPERDUDE [ Sat May 08, 2010 11:20 pm ]
Post subject:  RE:turing buttons

Syntax tags keeps indentation, and makes it slightly easier to read.
code:
[syntax="turing"] code here [/syntax]


: