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

Username:   Password: 
 RegisterRegister   
 How to call a procedure?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
dolly109




PostPosted: Sat Jun 02, 2012 12:56 pm   Post subject: How to call a procedure?

What is it you are trying to achieve?
[b]Im trying to call a procedure into another procedure
[/b]
What is the problem you are having?
< im making an online store program and im having troubles on my receipt page. My receipt is finished and i made a button for going to an info procedure page where the user types in their address and stuff but its not working. Im trying to go from my receipt page to the code listed below. I just can't figure out how to imply it into my program. >


Describe what you have tried to solve this problem
I tried calling the program but it didnt work.. it said "Missing parameters in call to subprogram "LastNameEntered" And putting the procedures into my info procedure didnt work either.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<This is the procedure im trying to import into my program. >

Turing:


procedure ZipEntered (text : string)
    GUI.SetSelection (FirstNameTextField, 0, 0)
    GUI.SetActive (FirstNameTextField)
end ZipEntered
procedure CityEntered (text : string)
    GUI.SetSelection (ZipTextField, 0, 0)
    GUI.SetActive (ZipTextField)
end CityEntered

procedure AddressEntered (text : string)
    GUI.SetSelection (CityTextField, 0, 0)
    GUI.SetActive (CityTextField)
end AddressEntered

procedure LastNameEntered (text : string)
    GUI.SetSelection (AddressTextField, 0, 0)
    GUI.SetActive (AddressTextField)
end LastNameEntered

procedure FirstNameEntered (text : string)
    GUI.SetSelection (LastNameTextField, 0, 0)
    GUI.SetActive (LastNameTextField)
end FirstNameEntered

FirstNameTextField := GUI.CreateTextFieldFull (70, 700, 100, "", FirstNameEntered, GUI.INDENT, 0, 0)
LastNameTextField := GUI.CreateTextFieldFull (70, 670, 100, "", LastNameEntered, GUI.INDENT, 0, 0)
AddressTextField := GUI.CreateTextFieldFull (70, 640, 100, "", AddressEntered, GUI.INDENT, 0, 0)
CityTextField := GUI.CreateTextFieldFull (70, 610, 100, "", CityEntered, GUI.INDENT, 0, 0)
ZipTextField := GUI.CreateTextFieldFull (70, 580, 100, "", ZipEntered, GUI.INDENT, 0, 0)

var FirstNameLabel := GUI.CreateLabelFull (60, 700, "First Name", 0, 0,
    GUI.RIGHT, 0)
var LastNameLabel := GUI.CreateLabelFull (60, 670, "Last Name", 0, 0,
    GUI.RIGHT, 0)
var AddressLabel := GUI.CreateLabelFull (60, 640, "Address", 0, 0,
    GUI.RIGHT, 0)
var CityLabel := GUI.CreateLabelFull (60, 610, "City", 0, 0,
    GUI.RIGHT, 0)
var ZipLabel := GUI.CreateLabelFull (60, 580, "Zip Code", 0, 0,
    GUI.RIGHT, 0)



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Sat Jun 02, 2012 1:06 pm   Post subject: RE:How to call a procedure?

"Missing parameters in call to subprogram"

Do you know what a parameter is? A parameter is the argument that goes into the parenthesis when you make the procedure. You need to put something there when you call it, too.
dolly109




PostPosted: Sat Jun 02, 2012 1:15 pm   Post subject: Re: How to call a procedure?

Oh. But whats meant to be put there?
Aange10




PostPosted: Sat Jun 02, 2012 1:32 pm   Post subject: RE:How to call a procedure?

What did you write inside the parenthesis?
dolly109




PostPosted: Sat Jun 02, 2012 1:49 pm   Post subject: Re: How to call a procedure?

I did what you said to do and put something in the parameters and now the program works... its just the procedures listed below are not ouputting.

Turing:

var FirstName, LastName, Address, City, Zip : string := " "

procedure ZipEntered (Zip : string)
    GUI.SetSelection (FirstNameTextField, 0, 0)
    GUI.SetActive (FirstNameTextField)
end ZipEntered

procedure CityEntered (City : string)
    GUI.SetSelection (ZipTextField, 0, 0)
    GUI.SetActive (ZipTextField)
end CityEntered

procedure AddressEntered (Address : string)
    GUI.SetSelection (CityTextField, 0, 0)
    GUI.SetActive (CityTextField)
end AddressEntered

procedure LastNameEntered (LastName : string)
    GUI.SetSelection (AddressTextField, 0, 0)
    GUI.SetActive (AddressTextField)
end LastNameEntered

procedure FirstNameEntered (FirstName : string)
    GUI.SetSelection (LastNameTextField, 0, 0)
    GUI.SetActive (LastNameTextField)
end FirstNameEntered



procedure info
    cls

    GUI.SetBackgroundColor (gray)
   
    FirstNameEntered (FirstName)
    LastNameEntered (LastName)
    AddressEntered (Address)
    CityEntered (City)
    ZipEntered (Zip)

end info

FirstNameTextField := GUI.CreateTextFieldFull (70, 700, 100, "", FirstNameEntered, GUI.INDENT, 0, 0)
LastNameTextField := GUI.CreateTextFieldFull (70, 670, 100, "", LastNameEntered, GUI.INDENT, 0, 0)
AddressTextField := GUI.CreateTextFieldFull (70, 640, 100, "", AddressEntered, GUI.INDENT, 0, 0)
CityTextField := GUI.CreateTextFieldFull (70, 610, 100, "", CityEntered, GUI.INDENT, 0, 0)
ZipTextField := GUI.CreateTextFieldFull (70, 580, 100, "", ZipEntered, GUI.INDENT, 0, 0)

var FirstNameLabel := GUI.CreateLabelFull (60, 700, "First Name", 0, 0,
    GUI.RIGHT, 0)
var LastNameLabel := GUI.CreateLabelFull (60, 670, "Last Name", 0, 0,
    GUI.RIGHT, 0)
var AddressLabel := GUI.CreateLabelFull (60, 640, "Address", 0, 0,
    GUI.RIGHT, 0)
var CityLabel := GUI.CreateLabelFull (60, 610, "City", 0, 0,
    GUI.RIGHT, 0)
var ZipLabel := GUI.CreateLabelFull (60, 580, "Zip Code", 0, 0,
    GUI.RIGHT, 0)
Aange10




PostPosted: Sat Jun 02, 2012 2:25 pm   Post subject: RE:How to call a procedure?

You should read the tutorial on procedures and functions at The Turing Walthrough. Your answer is there.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: