Calling a procedure with a variable procedure name 
Author Message
 Calling a procedure with a variable procedure name

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)?




Wed, 12 Mar 2003 03:00:00 GMT  
 Calling a procedure with a variable procedure name
Patrick,

Read my article 'Creating An MS OutLook-style Menu In Clarion: Part II'
http://www.clarionmag.com/v2n9/sub/v2n9outlookmenu2.html

Here I explain how it can be done.

Let me know when the Menu system is finished. I would very much like to post
some screen examples on my web site http://radmila.homepage.dk/ although I
have some time problems keeping it ajour but I am trying.

Steffen



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)?





Wed, 12 Mar 2003 03:00:00 GMT  
 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)?





Thu, 13 Mar 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. call procedure named in a variable?

2. procedure variables vs. type-bound procedures

3. How to setup a procedure in a DLL that calls a procedure in another DLL

4. Call a procedure from a procedure

5. Procedure that only calls a procedure?

6. calling non-PURE procedures in PURE procedures

7. How to make a procedure call from another procedure

8. Class procedure cannot call another class procedure

9. Start with a variable procedure name.

10. Procedure name in a string variable

11. Is there a variable for procedure name

12. using variables to create a procedure name

 

 
Powered by phpBB® Forum Software