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

Username:   Password: 
 RegisterRegister   
 Procedure help
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
pr0xiler




PostPosted: Fri Mar 11, 2005 11:16 pm   Post subject: Procedure help

I'm making a GUI program.. and im having trouble with procedures....

Is there a way to make a procedure return to the begining of the program from the top as in:

%top of program i want to return to

var random : int

put "Hi, welcome to my program"

procedure return1
(code to return to top here)
end return1

I then want to use this "return1" value in other procedures to return to the beginning of the program(marked by "%")

Basically what it does is open a new page after you click a button taking you somewhere.. and I want to make a back button(I already know how to make buttons) to return to the very beginning where the program started.

Thanks
Sponsor
Sponsor
Sponsor
sponsor
mike200015




PostPosted: Fri Mar 11, 2005 11:30 pm   Post subject: (No subject)

theres a few different ways you could do it, 1 way is , make the begining of the program into a procedure, and name it return 1, and then in the program when u type in return 1, then it will go back and run the begining of the program
Tony




PostPosted: Fri Mar 11, 2005 11:30 pm   Post subject: (No subject)

think loops
pr0xiler




PostPosted: Fri Mar 11, 2005 11:34 pm   Post subject: re

alright, i tried both ways... and a procedure cant be declared inside another procedure... and procedures cant be declared in loops.
mike200015




PostPosted: Fri Mar 11, 2005 11:37 pm   Post subject: (No subject)

if ur doing my way, then make them 2 seperate procedures, and if your doin tony's way then u dont need to make another procedure
pr0xiler




PostPosted: Fri Mar 11, 2005 11:46 pm   Post subject: (No subject)

could you please give me an example of how i could do this with loops? (BTW I have lots of procedures in the body of my code that i want to return to the top of also).

Thanks guys
mike200015




PostPosted: Fri Mar 11, 2005 11:50 pm   Post subject: (No subject)

can u post ur code.. or like 1 procedure of it.. so i can c wat ur programs like?
pr0xiler




PostPosted: Fri Mar 11, 2005 11:53 pm   Post subject: (No subject)

Heres the program (attatched)


gui1.tu
 Description:

Download
 Filename:  gui1.tu
 Filesize:  6.18 KB
 Downloaded:  137 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
mike200015




PostPosted: Fri Mar 11, 2005 11:54 pm   Post subject: (No subject)

k.. ill take a look.. and c if i can get it
pr0xiler




PostPosted: Fri Mar 11, 2005 11:55 pm   Post subject: (No subject)

Thank you Very Happy
Tony




PostPosted: Fri Mar 11, 2005 11:56 pm   Post subject: (No subject)

I wrote a tutorial on how to use loops to move around your program. I think you should read that.

While at it, read another tutorial to find out how to use procedures.
mike200015




PostPosted: Fri Mar 11, 2005 11:56 pm   Post subject: (No subject)

ok.. so what part do you want to return to.. the main screen wit all the buttons?
pr0xiler




PostPosted: Fri Mar 11, 2005 11:56 pm   Post subject: (No subject)

Thank you Very Happy

(I want to return it to the screen that shows on the startup of the program, when you press the back button)
pr0xiler




PostPosted: Fri Mar 11, 2005 11:57 pm   Post subject: (No subject)

Quote:

ok.. so what part do you want to return to.. the main screen wit all the buttons?


Thats right
mike200015




PostPosted: Fri Mar 11, 2005 11:59 pm   Post subject: (No subject)

so that part is at the bottom right now, correct?
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 2  [ 28 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: