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

Username:   Password: 
 RegisterRegister   
 Button is not working, due to procedure orders
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LOTR




PostPosted: Mon Jan 11, 2016 10:10 am   Post subject: Button is not working, due to procedure orders

I'm making an app where the user can navigate through pages to look at recipes. I'm having trouble woth the "Go Back" buttons, because Turing is telling me that the procedure is not previously declared.

I have the code for 4 buttons (4 procedures showing different recipes) and then the code for the page before it that shows the 4 options (In the app, there would be a page with 4 picture buttons for 4 different recipes, and a goback button. Clicking on one of the recipes will clear the screen, and output the recipe along with a picture, and a goback button.)

Order of procedures: procedure meal1, procedure meal2, procedure meal3, procedure meal4, procedure meals.

There's a button in each of the meal1/2/3/4, that calls upon the procedure meals, and there are 4 buttons in procedure meals that call upon the individual meal procedures.

Turing won't let me run the program, because it keeps saying the procedure meals is not previously declared. And I get the same problem if I put procedure meals at the beginning (it says procedure meal1/2/3/4 is not previously declared.

Any one know how to fix this?

Thanks!

BTW, I have my program attached in the file.



Final Project - DIY App.t
 Description:

Download
 Filename:  Final Project - DIY App.t
 Filesize:  24.23 KB
 Downloaded:  121 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Mon Jan 11, 2016 1:09 pm   Post subject: RE:Button is not working, due to procedure orders

Use the 'forward' and 'body' keywords to declare all your procedures at the top of the program.
LOTR




PostPosted: Tue Jan 12, 2016 10:54 am   Post subject: Re: RE:Button is not working, due to procedure orders

Insectoid @ Mon Jan 11, 2016 1:09 pm wrote:
Use the 'forward' and 'body' keywords to declare all your procedures at the top of the program.


I just tried it, and it worked! ... sort of. It stopped telling me that the variable has not been declared, but instead it's telling me that it's the wrong type.

ex.
% Before the meal1 procedure:
forward procedure meal1 ( var meals : string )

% From the meal1 procedure:
var GoBack_meal1 : int:=GUI.CreateButton(10,385,0, "Go Back", meals )

% Turing is telling me that 'meals' is the wrong argument type.

Any suggestions?
LOTR




PostPosted: Tue Jan 12, 2016 11:18 am   Post subject: Re: Button is not working, due to procedure orders

I fixed the problem! I just had to get rid of the section in brackets, and I no longer got the warning. No syntax errors now! Very Happy Very Happy

Thanks for your help!
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  [ 4 Posts ]
Jump to:   


Style:  
Search: