Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Editsource
Message
From
12/11/2001 16:38:43
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
12/11/2001 15:49:21
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00580610
Message ID:
00580633
Views:
20
>I created a wizard which creates a form calss by specifications entered.
>All works except a program cannot (as far as I know ) put code into a method in the created form.
>To overcome this I am trying to use editsource() which opens the method in an edit window ok. I ave the necessry code in the _cliptext.
>How can I keyboard or otherwise transfer this into the editwindow and therefore into the method??

Depends on what you're using. If it's VFP7, it has a new parameter in the .WriteMethod method, which will add a method if it doesn't exist. The object has to be in design mode, though (can't use this at runtime), so if you have the method text in a string in a builder, the thing would look like this:
=aselobj(aObs [, n])   && check this additional parameter in help
cMethodText=MyMethodBuilder()   && here you build the method
aObs[1].writemethod(cMethodName, cMethodText, <b>.t.</b>)
Be careful not to invent a method in a contained object, because it will get there, stay there for a while, and then vanish just like that. Adding methods to member objects was not in the design, it accidentally works and also accidentally stops to work.

If it's VFP6, you can do this (excellent trick developed by Rodrigo Juarez, member #035069):
=aselobj(aObs [, n])
cMethodText=MyMethodBuilder()
aObs[1].addproperty(cMethodName)
aObs[1].writemethod(cMethodName, cMethodText)
In this case, you have to close and save immediately after this, and reopen - the method should be there. I got this trick to work a couple of times, but it also failed a few times, so I'm not sure when it works and when not. Anyway, ingenious as it is, it came just too late, when we already got this in VFP7.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform