
Calling a procedure with a variable procedure name
Patrick,
The following code will randomly run TestProc or OtherProc to illustrate a
method of calling a procedure by name.
Create a hand coded project, in the main procedure do this:
PROGRAM
MAP
TestProc(),STRING
OtherProc(),STRING
END
DummyStr STRING(1)
ProcToRun STRING(50)
CODE
BIND('TestProc', TestProc)
BIND('OtherProc', OtherProc)
CASE RANDOM(0,1)
OF 0
ProcToRun = 'TestProc()'
ELSE
ProcToRun = 'OtherProc()'
END
DummyStr = EVALUATE(ProcToRun)
TestProc PROCEDURE
CODE
MESSAGE('TestProc')
RETURN('')
OtherProc PROCEDURE
CODE
MESSAGE('OtherProc')
RETURN('')
Regards,
J J
--
Be Kind, Be Careful, Be Yourself
--
Solid, reliable software at reasonable prices
http://www.johnjohnsonsoftware.com
Quote:
> Using C5EE in WinNT.
> For a Menu system, I have to call and/or Start various Clarion procedures
> for which I don't know the names during compile. The names of the
procedures
> are in a Topspeed file and the user can change their order of appearence
on
> the screen.
> Is there a possibility to do a Start(VariableProcedurename) (with or
without
> parameters)?