Calling a procedure from another procedure

Just starting out? Need help? Post your questions and find answers here.
User avatar
Columbo
Enthusiast
Enthusiast
Posts: 303
Joined: Wed Sep 10, 2014 7:17 am
Location: Ontario Canada
Contact:

Calling a procedure from another procedure

Post by Columbo »

If you have a button and that button calls one or more procedures, for example:

Code: Select all

#MyButton
  getRecord()
  displayRecord()
When you click #MyButton it calls the getRecord() procedure. When getRecord() has completed it returns to #MyButton and then calls displayRecord().

My question is,… It is my understanding that it is possible to call a procedure from within another procedure. If this is true,… let’s say that when #MyButton is pressed it calls getRecord(). Then at some point getRecord() calls anotherProcedure(). When anotherProcedure() has completed, where does the program flow return to? Back to the getRecord() that called it or back to #MyButton to call the displayRecord()?

Kind of hard to explain but, hopefully you get the drift of what I am asking.

Thanks.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
camille
User
User
Posts: 71
Joined: Tue Nov 19, 2019 12:52 pm

Re: Calling a procedure from another procedure

Post by camille »

To getRecord().
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Calling a procedure from another procedure

Post by Saki »

Hi,
just do it with Select Case Endselect

In each case you call a procedure and it returns automaticaly to that case
地球上の平和
#NULL
Addict
Addict
Posts: 1497
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Calling a procedure from another procedure

Post by #NULL »

Run the following code with debugger enabled, then you can use the IDE Menu > Debugger > Step (or the toolbar icon) ..to see what happens

Code: Select all

CallDebugger

Procedure b()
  Debug "in b"
EndProcedure

Procedure a()
  Debug "in a 1"
  b()
  Debug "in a 2"
EndProcedure

a()
User avatar
Columbo
Enthusiast
Enthusiast
Posts: 303
Joined: Wed Sep 10, 2014 7:17 am
Location: Ontario Canada
Contact:

Re: Calling a procedure from another procedure

Post by Columbo »

Thanks for the responses. It does return to getRecord(). Perfect!

Thanks again.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
Post Reply