Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem using execscript
Message
De
01/07/2015 04:21:43
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01621618
Message ID:
01621646
Vues:
47
Again

- do not bind to the class defined in execscript. IOW do not define a class in a execscript you like to use outside the execscript
--bind to a method of the grid or the form
--if you realy need the high dynamic create some procdure or function you call from that method as a prg file. It will work just the same way your execscript will, but it will remain as long as you will not delete it. The execscript creates a temporary prg too, but will delete it as soon as it is finished

The advice for the property was general. Do not use public vars.

>i have also tried to use a property in the form, not created with addproperty, but in the form designer, but i have the same problem. in the execscript i can see rhe obiect and when i exit the execscript the property is null.
>
>
>
>>Looks like a problem with the class definiton lost.
>>
>>Instead of execscript, create a prg in tmp folder and call this. Delete the prg after the the last instance of myhandler is erased.
>>
>>Do not use public vars. Bound the handler to the form (ADDPROPERTY ...)
>>
>>Much more elegant is to subclass grid, add a method to it and put code there. Then you can eventbind to this. From there you can call what you like.
>>
>>
>>>Hi. In my app i have this situation:
>>>a form with a grid; this grid is designed at runtime using code saved in amemo field of a foxpro table using execscript() function. And up to here no problems.
>>>Every column of the grid can be doubleclicked and in the column1.text1.dblclick i call a method of the form passing to it the column1.controlsource. Obviously this method has to execute a code that depends from the code with which i designed the grid....My idea was to use in that code use a define class to create an objext to overwrite with bindevent ten code in form.method......When designing the grid i pass to the execscript some parameters and one of these is the form object that i use in the code...
>>>
>>>* example of execscript code
>>>lparameters xPar1, xPar2, oForm
>>>* code to design the grid
>>>Public oMyHandler
>>>oMyHandler = createObject("myHandler")
>>>
>>>=BidndEvent(oForm,"method",oMyHandler,"myClick")
>>>
>>>oForm.method("test")
>>>
>>>define class myHandler as session
>>>procedure myclick
>>>lparameter cControlSource
>>>messagebox(cControlSource)
>>>endproc
>>>enddefine
>>>
>>>This is an example code of the execscript and i if i insert after the bindevent function a call to the method, it works and it shows the name of the text i pass to the method....the problem is that when i return to the form and the execscript has ended the bindevent() has no effect.....
>>>
>>>
>>>i tried to delete the execution of the bindevent in the execscript and do it directly in the method receivinf from it the oMyHandler object, but without success because even if it is a public variable after the execution of the exescript code it is always .NULL. even if i define it the form.method (only public oMyHandler).
>>>
>>>someone has suggests....
>>>
>>>excuse me if my explanation is not so clear....
>>>
>>>thanks
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform