Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access and Assign
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00169870
Message ID:
00170187
Views:
32
Hi Ned,

>The second is having outside events interrupt the execution of the code in the _Access and _Assign methods (see AutoYield property and VFP processing of Windows events) and potentially calling code that modifies the property being managed by the _Access or _Assign method that is currently running

I start realizing, how important your question is and wrote a little test program that you find below. It has an Assign method that takes 5 seconds. Via a hotkey (F9) you can change the proeprty a second time while Assign is still executing. When you run it, you can find that VFP doesn't recursively fire the Assign method, instead it changes the property directly bypassing the Assign method!
      Clear
      Public ox
      ox = CreateObject("Test")
      On Key Label F9 ox.Test()
      ox.cTest = "World"
      ? ox.cTest
      Release ox

      Define Class Test as Label
         cTest = ""
         Procedure cTest_Assign(tuValue)
            cOldValue = This.cTest
            ? "cTest_Assign called"
            nStart = Seconds()
            Do While nStart+5 > Seconds()
               If cOldValue # This.cTest
                  cOldValue = This.cTest
                  ? "cTest changed"
               Endif
            Enddo
            This.cTest = tuValue
            ? "cTest_Assign returns"
         EndProc
         Procedure Test
            ? "Test called"
            This.cTest = "Hello"
            ? This.cTest
            ? "Test returns"
         EndProc
      Enddefine
Christof
--
Christof
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform