Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access and Assign
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00169870
Message ID:
00170187
Vues:
33
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform