Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Commands in memo field
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00507485
Message ID:
00507838
Vues:
16
>Hi!
>
>Something like following:
>
>
>#DEFINE CRLF chr(13)+chr(10)
>
>&& prepare class definition in the PRG file that contains custom code from memo field in the method
>lcMyPRG = "DEFINE CLASS MyClass AS Custom" + CRLF + ;
>"PROCEDURE DoSomeCode" + CRLF + ;
>MyAlias.MyMemoFieldWithCode + CRLF + ;
>"ENDPROC" + CRLF + ;
>"ENDDEFINE" + CRLF
>
>&& prepare PRG file
>strtofile(lcMyPRG,"TempPRG.PRG")
>compile TempPRG.PRG
>set proc to TempPRG.PRG ADDITIVE
>
>thisform.AddObject("TempObject","MyClass") && create temporary objkect
>
>&& run custom code in run-time
>&& this way "thisform" is available in the custom code
>= thisform.TempObject.DoSomeCode()
>
>thisform.RemoveObject("TempObject") && remove temporary objkect
>RELEASE PROCEDURE TempPRG.PRG && I'm nto sure this is correct, no time to look to help ;)
>
>

Great, this is what I thought - a new custom object defined on the fly. Very clever!

BTW, you don't need to set and release procedure if you will use NewObject method (VFP6.0 and greater).

>>>Hi!
>>>
>>>Definitely you can wrap the code into the method inside of the DEFINE CLASS construction. Than use generated PRG file to put custom control on the form. Than call a method - thisform is available.
>>>
>>>HTH.
>>>
>>
>>Vlad,
>>
>>I'm not sure, I understood your idea, could you please elaborate more?
>>
>>Thanks in advance.
>>>
>>>
>>>
>>>>>Or you can try:
>>>>>
>>>>>strtofile(table1.memofield, 'c:\apractic\junk\table1.prg')
>>>>>compile 'c:\apractic\junk\table1.prg'
>>>>>do 'c:\apractic\junk\table1.prg'
>>>>
>>>>That is well and good, but his example had commands like THISFORM in it. You will get errors compiling and running an external PRG. You would have to change it to something like _Screen.ActiveForm. However, I am not quite sure why anyone would want to do it that way intead of just putting generic code in a method in the form or appropriate control. If you wanted to make the property options data-driven, I would have a table with FormName, Property and PropValue fields that would contain the appropriate values instead of storing an entire command line in a table.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform