Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I add some code to multiple methods
Message
 
 
To
14/10/2003 10:12:41
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00838523
Message ID:
00838625
Views:
24
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform