Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programmatically add code to all controls
Message
De
11/12/2003 17:35:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00858363
Message ID:
00858393
Vues:
15
That's what I'm currently working on, but for some reason after I do a dodefault in the init of the form, my labojects array does not get created using the code below:
WITH THIS
    ASELOBJ(laobjects,1)
    FOR EACH oControl IN laobjects
		LcDesiredCode = "THISFORM.mcalendorse=.T." + CHR(13) ;
		+ oControl.ReadMethod("VALID")
		oControl.WriteMethod("VALID", LcDesiredCode) 
    ENDFOR
ENDWITH
Any idea what I am doing wrong?
>Unless you have VFP8 and use BINDEVENT, this will not work at runtime. The only other option is to write a little PRG that will loop through all the pages on the form and the textboxes and use WRITEMETHOD to write code to whatever method you want in those textboxes.
>
>>I don't want it on every form in the project though (only one) and the textboxes already exist ON this form and there are 7 pages and hundreds of textboxes...
>>
>>I was hoping to issue something in the init of the form after DODEFAULT() that would step through all of the controls and add the code to the valid that time...
>>
>>
>>>Why not just put something in your Textbox baseclass GOTFOCUS method? If you
>>>have VFP8, this would be a good use of BINDEVENT but then you would have to issue a BINDEVENT for every textbox control on the form. Putting code in 1 baseclass textbox seems easier. Or have I missed your point?
>>>
>>>>I would like to programmatically add code to all textbox controls on a form. Ideally, the textbox valids would have:
>>>>
>>>>
>>>>THISFORM.mcalendorse=.T.
>>>>
>>>>
>>>>so that whenever a user keys through a textbox control on the form, the form's value of mcalendorse is set to true. It needs to go BEFORE any other existing code already in the valid. I need to know if the user keyed through the text box controls at all. Can .setall be used for this? How to do it ?
>>>>
>>>>TIA,
>>>>Tracy
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform