Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Vlad,
Thanks. This is a good idea. That is where I was going if in fact you couldn't add the method code at run time. Now that I know you can't, I will do it the way you have suggested.
>Hi!
>
>You cannot do this in run-time, VFP does not allow to change methods code in run-time.
>
>However, you can solve this problem by easy way by making a text box class with generic functionality.
>
>Make a textbox class. Add property 'ValidationNumber'. In valid event add code:
>thisform.ValidateTextbox(this)
>OR
>this.parent.ValidateTextbox(this)
>
>In the form (or container) make above custom method and put code there:
>lparameters poTextBox
>do case
>case poTextBox.ValidationNumber = 1
>...
>case poTextBox.ValidationNumber = 2
>...
>...
>endcase
>
>This way you still will be able to put your class in run-time using addobject(), but assign the validation routine umber to the property of textbox instead of code assignment to method.
>
>HTH.
>
>>I am creating a set of text boxes, in a container, at run time, with addobject(), based on the values in a table. I am using the textbox base class as the class on which to base the text boxes. (maybe I shouldn't ?). But ideally I want each text box to have it's own custom valid method. I guess if I based it on a different subclass of textbox, it could inherit the valid, this would be better, but still might not do the trick.
>>
>>Is it possible to create the valid at runtime, per text box ? I see no
>>addmethod() method, just addproperty()
>>
>>Thanks.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement