Board index » delphi » Execute a function of which the name is in a string variable
Giovanni Praet
![]() Delphi Developer |
Sat, 14 Feb 2004 06:23:44 GMT
|
Giovanni Praet
![]() Delphi Developer |
Sat, 14 Feb 2004 06:23:44 GMT
Execute a function of which the name is in a string variable
Hello,
I have a list of functions (which are possible to execute by a user) in a Thnkx Gigi :-) |
J Fren
![]() Delphi Developer |
Sat, 14 Feb 2004 18:57:26 GMT
Re:Execute a function of which the name is in a string variableIf your App were a DLL then you could use LoadLibrary and GetProcAddress On Tue, 28 Aug 2001 00:23:44 +0200, "Giovanni Praet" Quote<g...@protelco.be> wrote: |
Sven Pra
![]() Delphi Developer |
Sat, 14 Feb 2004 22:38:10 GMT
Re:Execute a function of which the name is in a string variableThe straight forward way is to use a case statement having enumerated your list of function (and function names): The user selection ends up with a number indexing the case functionindex of hope this gives you an idea. regards Sven Quote"Giovanni Praet" <g...@protelco.be> wrote in message Quote> Hello, |
Bob Richardso
![]() Delphi Developer |
Sat, 14 Feb 2004 23:00:53 GMT
Re:Execute a function of which the name is in a string variableQuote> I have a list of functions (which are possible to execute by a user) in a function StringIndex(const SearchString : string; StrList : array of string) function StrFunction(FuncName : string) : boolean; |
AlanGLLo
![]() Delphi Developer |
Sun, 15 Feb 2004 16:30:41 GMT
Re:Execute a function of which the name is in a string variableIn article <9mehej$30...@news.planetinternet.be>, "Giovanni Praet" Quote<g...@protelco.be> writes: references to the function in a list, and when the name is selected call the reference. Something like ... type {declare procedures} procedure ProcOne(I : integer); // type TProcB procedure ProcTwo(S : string); // type TProcC function FunctionThree : string; // type TFuncD procedure TForm1.FormCreate(Sender: TObject); procedure TForm1.ListBox1DblClick(Sender: TObject); Alan Lloyd |
John
![]() Delphi Developer |
Mon, 16 Feb 2004 00:39:52 GMT
Re:Execute a function of which the name is in a string variableNice suggestion, but it defeats the purpose. You are back to a case statement if your parameter lists are different. I would suggest that all procedures take the same parameters, in which case you can do the following: procedure TForm1.ListBox1DblClick(Sender: TObject); If you want parameters, then standardise them. -- Quote"AlanGLLoyd" <alangll...@aol.com> wrote in message Quote> In article <9mehej$30...@news.planetinternet.be>, "Giovanni Praet" |
AlanGLLo
![]() Delphi Developer |
Mon, 16 Feb 2004 03:05:12 GMT
Re:Execute a function of which the name is in a string variableIn article <999103099.775...@ftp.adept.co.za>, "John" <nom...@nomail.com> writes: Quote>Nice suggestion, but it defeats the purpose. You are back to a case has. And of course, the code I posted was just exemplary. Alan Lloyd |
Bruce Robert
![]() Delphi Developer |
Mon, 16 Feb 2004 03:04:33 GMT
Re:Execute a function of which the name is in a string variableQuote"Giovanni Praet" <g...@protelco.be> wrote in message Quote> Hello, use something like: Type procedure P1 (<parameters>); procedure P2 (<parameters>); const procedure RunIt (proc : string); function ProcIx (proc : string); begin begin |
1. Execute a function of which the name is in a string
2. Executing a procedure by its name as String...
3. Joining A String Variable to a object name
4. Function/Procedure name as variable
5. Variable name to string representation ???
6. Storing a variable name in a string field
7. Create object by type name (String variable), HOW?!?!?
8. Access Violation in Thread when using Copy function on a local String variable