Starting the function of the variable value
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Starting the function of the variable value
How to run on the execution of the function, the name of which is given in the form of a variable value?
Re: Starting the function of the variable value
I do not understand your question. Please clarify.
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Starting the function of the variable value
For example, the program has a function: F1_8(). There are variable: mFunct = "F1_8()". Usually this function to start the program I am writing: F1_8(). And how do I start it for execution with the function name as a variable value mFunct? @mFunct why something does not work.
Re: Starting the function of the variable value
For example, the program has a function: F1_8(). There are variable: mFunct = "F1_8()". Usually this function to start the program I am writing: F1_8(). And how do I start it for execution with the function name as a variable value mFunct? @mFunct why something does not work.
Code: Select all
&mFunct
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Starting the function of the variable value
This is me at once and tried. Somehow, when you compile the message: "error XBT0250: Incomplete expression"
Re: Starting the function of the variable value
"F1_8()" can't be a STATIC function if you try to do this.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Starting the function of the variable value
Show the exact code.
The eXpress train is coming - and it has more cars.
Re: Starting the function of the variable value
This works:
Code: Select all
FUNCTION Main()
cTest := "MyFunc()"
&(cTest)
RETURN nil
FUNCTION MyFunc()
MsgBox('Test')
RETURN nil
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Starting the function of the variable value
Thank you, Tom!
Live and learn! About the fact that you need to write a function name in parenthesis, I never would have guessed. Or rather, I remembered that so you can do with the files, but never did so with the function name. And there is still a macro substitution. Such a design I had never used, but now I will, because it is very convenient in some cases. And most importantly - works great!
Live and learn! About the fact that you need to write a function name in parenthesis, I never would have guessed. Or rather, I remembered that so you can do with the files, but never did so with the function name. And there is still a macro substitution. Such a design I had never used, but now I will, because it is very convenient in some cases. And most importantly - works great!
Re: Starting the function of the variable value
I forgot the parenthesis. Sorry.
BTW - Here is how you pass local parameters to a macro-compiled function:
BTW - Here is how you pass local parameters to a macro-compiled function:
Code: Select all
&(myFunc)(a,b,c,d)
The eXpress train is coming - and it has more cars.