Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically creating method or event procedure
Message
From
23/02/1999 00:10:01
 
 
To
22/02/1999 23:51:54
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00189903
Message ID:
00190321
Views:
16
>>This works, but only if you're using the development version of VFP to run ypour code - you can't do this directly from a compiled .EXE, since there's no built-in mechanism to convert the text to a compiled form.
>>
>>One 'trick' here is to use CodeBlock(), which provides an interpreter that can be included in the compiled application and used to execute the code built on the fly.
>>
>
>Ed,
>
>Could you please explain the CodeBlock() you mentioned?
>
>Thanks a lot!
>
>Ben

CodeBlock is a public domain utility written by Randy Pearson that basically takes a program, whether from a text file, memo field, or a string, and runs it line by line using Macro Expansion (&). It allows for many controls structures like IF..ENFIF, DO WHILE etc, that would normally be impossible with plain macro expansion.

It is necessary if you want to store method code in a memo field for whatever reason, and run it in your program. This is because, as Ed mentioned, VFP exes don't have the ability to compile source code into object code.

This ability doesn't change the fact that the original question should probably be handled with classes instead of dynamically adding and compiling code.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform