Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I add some code to multiple methods
Message
 
 
À
14/10/2003 10:12:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00838523
Message ID:
00838625
Vues:
23
>I have a VFP 8 multiple page pageframe that contains about 100 text boxes. I want to stick in a line of code, "m_fieldmodified=.T.", in the interactivechange event of each text box. Many of the text boxes already have text in the interactive change event. Is there a quick way of doing this?
>
>Thanks,
>

Vim,
Another approach would be to use the BindEvent() function in VFP 8.
define class cusEvtHandler as Custom

procedure ICHandler
m_fieldmodified = .T.
endproc
enddefine
In the form's Init, add the following:
local lnctrlcnt
THIS.AddObject('oevthandler','cusEvtHandler')
for lnctrlcnt = 1 to THIS.ControlCount
   if upper(THIS.Controls[lnctrlcnt].BaseClass) = 'TEXTBOX' then
      bindevent(THIS.Controls[lnctrlcnt],'InterActiveChange', THIS.oevthandler,'ICHandler')
   endif
endfor
Depending on the scope of m_fieldmodified, this should work. When the form is released, all the binding will go away automatically.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform