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

Username:   Password: 
 RegisterRegister   
 Procedures in Procedures, and "going back" buttons
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chrispaks




PostPosted: Wed May 18, 2005 4:38 pm   Post subject: Procedures in Procedures, and "going back" buttons

Im having problems with putting procedures in procedures...

Such as (for example, some things are missing but this is an example):

proc test1
put "hi"
put "press button to ask for whats up"
var b2 := GUI.CreateButton (235, 280, 200, "Say whats up", SecondThing)
end test1

proc SecondThing
put "Whats up?"
test1 <---- the procedure from the above
end SecondThing

There declared in each other... do i use forward proc? and how does that work cause I tried it, but I do not understand it (the help in Turing isnt perfect either)



And is there a place I can get a code to check how to make buttons to go back and forth in GUI just like the ^
Sponsor
Sponsor
Sponsor
sponsor
chrispaks




PostPosted: Wed May 18, 2005 5:14 pm   Post subject: (No subject)

Ok that works lol

If you know the procedures, for going back and forth, let me give you an example:

This is my actual code for the interface of the program (well the GUI part)

Quote:
proc PROGRAM
View.Set ("graphics:460;350,nobuttonbar")

GUI.SetBackgroundColour (grey)

var f2 := GUI.CreateLabelledFrame (5, 330, 450, 100, GUI.INDENT,
"Welcome to the 'Tri-G-ame' program!")


var b1 := GUI.CreateButton (15, 280, 200, "Sin Cos Tan Calculator", IncompleteProc)
var b2 := GUI.CreateButton (235, 280, 200, "Triangle Length/Angle Finder", TriangleFinder)
var b3 := GUI.CreateButton (15, 200, 200, "Full Scale Calculator", IncompleteProc)
var b4 := GUI.CreateButton (235, 200, 200, "Tag Game (2 player only)", IncompleteProc)
var b5 := GUI.CreateButton (15, 120, 200, "Factor Display Program", IncompleteProc)
var b6 := GUI.CreateButton (235, 120, 200, "Interesting Sites you may visit", IncompleteProc)

var f1 := GUI.CreateLabelledFrame (130, 10, 320, 60, GUI.INDENT,
"Quit the Tri-G-ame program")

var quitButton := GUI.CreateButton (150, 20, 150, "Quit Program", QuitPressed)

loop
exit when GUI.ProcessEvent
end loop

GUI.Dispose (b1)
GUI.Dispose (b2)
GUI.Dispose (b3)
GUI.Dispose (b4)
GUI.Dispose (b5)
GUI.Dispose (b6)
GUI.Dispose (f1)
GUI.Dispose (f2)
GUI.Dispose (quitButton)

var f3 := GUI.CreateLabelledFrame (130, 10, 320, 60, GUI.INDENT,
"Program By")

var ln1 := GUI.CreateLine (10, 140, 450, 140, GUI.INDENT)

var exitMessage := GUI.CreateLabelFull (0, 120, "Program Exited",
maxx, maxy - 135, GUI.CENTER + GUI.MIDDLE, 0)
var exitMessage2 := GUI.CreateLabelFull (0, 100, "Click the 'close' button to close the program window",
maxx, maxy - 135, GUI.CENTER + GUI.MIDDLE, 0)
var exitMessage3 := GUI.CreateLabelFull (-3, -73, "Chrispaks",
maxx, maxy - 135, GUI.CENTER + GUI.MIDDLE, 0)
end PROGRAM


and my second part of the program (the trig part)

Quote:
proc TriangleFinder
Tons of code here, so ill just remove it all to save on forum space and lag time... (basically its like a sincostan program used for finding sides and stuff

So the code goes on... (Pretend this is near the end)

.....
cls
put "Program completed"
delay (1500)
THIS IS WHERE I WANT IT TO RETURN TO GUI MENU\/
PROGRAM <--- procedure for my uber cool GUI menu


end TriangeFinder


Is that the way around it or do i need another way?
StarGateSG-1




PostPosted: Thu May 19, 2005 7:27 am   Post subject: (No subject)

You use forword and body>

code:
%put this at the top of uyour code
forward procedure whatever

%This can go anywere
body procedure whatever
...
...
end whatever


Now you call this procedure over and over.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: