Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating an event on the fly
Message
From
06/06/2001 10:19:49
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00515711
Message ID:
00515755
Views:
10
Hi!

With the ability to use 'COMPILE' command in run-time, you can do that. Prepare a code string and write it to PRG file. Compile PRG file using COMPILE command. Than SET PROCEDURE to that FXP file. than create the object. Quite workarounding, but possible.

>Vlad,
>That's not exactly run-time code. The class is pre-defined with the code already in the event. Now you can generate a class on the fly using FCreate(), FPuts() and FClose() but the code you add to the events is also pre-defined. When the class is compiled and instantiated, all of its methods are then static. You can't then change the event/method code unless you remove the class from memory, regenerate it in the PRG, recompile and then reinstantiate it.
>
>To me that's not dynamic event/method manipulation but using a different class to do the job.
>
>>Hi!
>>
>>You can change code in run-time. See Thread #503869 Message #503953 and next messages.
>>
>>>>I am creating a form with a grid and I need to set all the properties of the grid on the fly.
>>>>It is easy to change the caption property:
>>>>ThisForm.Grid1.column1.header1.caption = "Name"
>>>>
>>>>But how do I change the Click Event?
>>>>
>>>>Thanks
>>>>Einar
>>>
>>>You can not change method code on the fly. Programmatically this can be done in the development environment using WriteMethod. This is not available at run time.
>>>
>>>What are you trying to do? Maybe there is another way of doing it?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform