Page 1 of 1

Calling a procedure from another procedure

Posted: Mon Dec 28, 2020 5:50 pm
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.

Re: Calling a procedure from another procedure

Posted: Mon Dec 28, 2020 5:55 pm
by camille
To getRecord().

Re: Calling a procedure from another procedure

Posted: Mon Dec 28, 2020 5:57 pm
by Saki
Hi,
just do it with Select Case Endselect

In each case you call a procedure and it returns automaticaly to that case

Re: Calling a procedure from another procedure

Posted: Mon Dec 28, 2020 6:02 pm
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()

Re: Calling a procedure from another procedure

Posted: Mon Dec 28, 2020 7:06 pm
by Columbo
Thanks for the responses. It does return to getRecord(). Perfect!

Thanks again.