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

Username:   Password: 
 RegisterRegister   
 Help making an exit button on this program using GUI
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bobby321




PostPosted: Thu Jan 19, 2012 6:53 pm   Post subject: Help making an exit button on this program using GUI

What is it you are trying to achieve?
Making an exit button on this program using GUI so the user can exit and start all over.


What is the problem you are having?
For some reason the GUI button isn't working...


Describe what you have tried to solve this problem
Researched..


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
import GUI
setscreen ("nocursor")
setscreen ("noecho")

% Button
var exitButton : int := 0

procedure drawrectangle
%screen formatting
setscreen ("graphics:800;400")
%orange button
var number : int
var rangeX, rangeY, button : int
cls
drawfillbox (200, 50, 250, 100, 42)
%keyboard input
put "Enter your temperature in farenheit from -4 to 68"
get number
put "Your temperature in celcius is:", (5 / 9) * (number - 32);
put "Click on the orange box to repeat"


%Mouse input
loop
mousewhere (rangeX, rangeY, button)
if (rangeX >= 200 and rangeX <= 250) and (rangeY >= 50 and rangeY <= 100) and button = 1 then
drawrectangle
else

end if
%Red box
drawbox (20, 40, 70, 100, 12)
drawbox (20, 100, 70, 160, 12)
drawbox (20, 160, 70, 220, 12)
drawbox (20, 220, 70, 280, 12)
%Yellow box
drawbox (75, 40, 125, 100, 14)
%Blue box
drawbox (130, 40, 180, 100, 54)
drawbox (130, 100, 180, 160, 54)
drawbox (130, 160, 180, 220, 54)
drawbox (130, 220, 180, 280, 54)
Text.Locate (1, 5)

for x : 10 .. 59
%The blue thermometer
if number = -4 then
drawfillbox (130, 40, 180, 220 + x, 54)
end if
if number = -3 then
drawfillbox (130, 40, 180, 210 + x, 54)
end if
if number = -2 then
drawfillbox (130, 40, 180, 205 + x, 54)
end if
if number = -1 then
drawfillbox (130, 40, 180, 200 + x, 54)
end if
if number = 0 then
drawfillbox (130, 40, 180, 195 + x, 54)
end if
if number = 1 then
drawfillbox (130, 40, 180, 190 + x, 54)
end if
if number = 2 then
drawfillbox (130, 40, 180, 185 + x, 54)
end if
if number = 3 then
drawfillbox (130, 40, 180, 180 + x, 54)
end if
if number = 4 then
drawfillbox (130, 40, 180, 175 + x, 54)
end if
if number = 5 then
drawfillbox (130, 40, 180, 170 + x, 54)
end if
if number = 6 then
drawfillbox (130, 40, 180, 165 + x, 54)
end if
if number = 7 then
drawfillbox (130, 40, 180, 160 + x, 54)
end if
if number = 8 then
drawfillbox (130, 40, 180, 155 + x, 54)
end if
if number = 9 then
drawfillbox (130, 40, 180, 150 + x, 54)
end if
if number = 10 then
drawfillbox (130, 40, 180, 145 + x, 54)
end if
if number = 11 then
drawfillbox (130, 40, 180, 140 + x, 54)
end if
if number = 12 then
drawfillbox (130, 40, 180, 135 + x, 54)
end if
if number = 13 then
drawfillbox (130, 40, 180, 130 + x, 54)
end if

if number = 14 then
drawfillbox (130, 40, 180, 125 + x, 54)
end if
if number = 15 then
drawfillbox (130, 40, 180, 120 + x, 54)
end if
if number = 16 then
drawfillbox (130, 40, 180, 115 + x, 54)
end if
if number = 17 then
drawfillbox (130, 40, 180, 110 + x, 54)
end if
if number = 18 then
drawfillbox (130, 40, 180, 105 + x, 54)
end if
if number = 19 then
drawfillbox (130, 40, 180, 100 + x, 54)
end if
if number = 20 then
drawfillbox (130, 40, 180, 95 + x, 54)
end if
if number = 21 then
drawfillbox (130, 40, 180, 90 + x, 54)
end if
if number = 22 then
drawfillbox (130, 40, 180, 85 + x, 54)
end if
for y : 10 .. 19
if number = 23 then
drawfillbox (130, 40, 180, 80 + y, 54)
end if
if number = 24 then
drawfillbox (130, 40, 180, 75 + y, 54)
end if
if number = 25 then
drawfillbox (130, 40, 180, 70 + y, 54)
end if
if number = 26 then
drawfillbox (130, 40, 180, 65 + y, 54)
end if
if number = 27 then
drawfillbox (130, 40, 180, 60 + y, 54)
end if
if number = 28 then
drawfillbox (130, 40, 180, 55 + y, 54)
end if
if number = 29 then
drawfillbox (130, 40, 180, 50 + y, 54)
end if
if number = 30 then
drawfillbox (130, 40, 180, 45 + y, 54)
end if


if number = 31 then
drawfillbox (130, 40, 180, 40 + y, 54)
end if
end for

for a : 40 .. 100

%the yellow thermometer
for b : 10 .. 20
if number = 32 then
drawfillbox (75, 40, 125, 40 + x, 14)
end if
end for

% The Red Thermometer
if number = 33 then
drawfillbox (20, 40, 70, 0 + x, 12)
end if
if number = 34 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 35 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 35 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 36 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
end for
if number = 37 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 38 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 39 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 40 then
drawfillbox (20, 40, 70, 30 + x, 12)
end if
if number = 41 then

drawbox (20, 40, 70, 30 + x, 12)

end if

if number = 42 then
drawfillbox (20, 40, 70, 5 + x, 12)

end if

if number = 43 then
drawfillbox (20, 40, 70, 10 + x, 12)

end if
if number = 44 then
drawfillbox (20, 40, 70, 15 + x, 12)

end if
if number = 45 then
drawfillbox (20, 40, 70, 20 + x, 12)

end if
if number = 46 then
drawfillbox (20, 40, 70, 25 + x, 12)

end if
if number = 47 then
drawfillbox (20, 40, 70, 30 + x, 12)
delay (10)
end if
if number = 48 then
drawfillbox (20, 40, 70, 35 + x, 12)
delay (10)
end if
if number = 49 then
drawfillbox (20, 40, 70, 40 + x, 12)
delay (10)
end if
if number = 50 then
drawfillbox (20, 40, 70, 60 + x, 12)
delay (10)
end if
if number = 51 then
drawfillbox (20, 40, 70, 65 + x, 12)
delay (10)
end if
if number = 52 then
drawfillbox (20, 40, 70, 70 + x, 12)
delay (10)
end if
if number = 53 then
drawfillbox (20, 40, 70, 75 + x, 12)
delay (10)
end if
if number = 54 then
drawfillbox (20, 40, 70, 80 + x, 12)
delay (10)
end if
if number = 55 then
drawfillbox (20, 40, 70, 85 + x, 12)
delay (10)
end if
if number = 56 then
drawfillbox (20, 40, 70, 90 + x, 12)
delay (10)
end if
if number = 57 then
drawfillbox (20, 40, 70, 95 + x, 12)
delay (10)
end if
if number = 58 then
drawfillbox (20, 40, 70, 100 + x, 12)
delay (10)
end if
if number = 59 then
drawfillbox (20, 40, 70, 115 + x, 12)
delay (10)
end if
if number = 60 then
drawfillbox (20, 40, 70, 120 + x, 12)
delay (10)
end if
if number = 61 then
drawfillbox (20, 40, 70, 125 + x, 12)
delay (10)
end if
if number = 62 then
drawfillbox (20, 40, 70, 130 + x, 12)
delay (10)
end if
if number = 63 then
drawfillbox (20, 40, 70, 135 + x, 12)
delay (10)
end if
if number = 64 then
drawfillbox (20, 40, 70, 140 + x, 12)
delay (10)
end if
if number = 65 then
drawfillbox (20, 40, 70, 145 + x, 12)
delay (10)
end if
if number = 66 then
drawfillbox (20, 40, 70, 150 + x, 12)
delay (10)
end if
if number = 67 then
drawfillbox (20, 40, 70, 160 + x, 12)
delay (10)
end if
if number = 68 then
drawfillbox (20, 40, 70, 180 + x, 12)
delay (10)
end if
exitButton := GUI.CreateButton (450, 30, 0, "Exit", exitButton)
end for
end loop
end drawrectangle
drawrectangle
loop
exit when GUI.ProcessEvent
end loop

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Alex C.




PostPosted: Thu Jan 19, 2012 8:29 pm   Post subject: RE:Help making an exit button on this program using GUI

first off USE CODE TAGS Evil or Very Mad
second have you looked into using Mouse.Where?
if not, there are tutorials that can help you with that in the Turing Walkthrough
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  [ 2 Posts ]
Jump to:   


Style:  
Search: