Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Repeated calls to custom class method causes Page Fault
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00184056
Message ID:
00185340
Vues:
23
You can do any validation that you want in the Assign method, as long as you don't create a circular reference (Property1_Assign call Property2_Assign who call Property1_Assign etc.)

If you don't assign any value to the current property in the Assign method, the new value will be discarded. Here's an example of what I think you are trying to implement:
PROCEDURE MyProperty_Assign
LPARAMETERS vNewVal

IF VarType(vNewVal) <> "N"
   IF (VarType(vNewVal) = "C") AND IsDigit(vNewVal)
      THIS.MyProperty = Val(vNewVal)
   ELSE
      ERROR 1732  && "Data type invalid for this property"
   ENDIF
ELSE
   This.MyProperty = vNewVal
ENDIF
RETURN
HTH

>OOPS! It seems that I have mislead myself. I am running Visual FoxPro 6.0, with the latest service pack installed. By recreating the class one method at a time, I have narrowed the problem down to one of two things.
>
> 1) The class library has become corrupted.
> 2) In creating _assign methods, it appears as though
> I have caused a recursion in which the _assign method
> actually calls itself. This seems to have filled the
> stack buffer, which subsequently caused the Invalid
> Page Fault.
>
>My conclusion, however valid, is that it seems somewhat safe to
>set the value of a property other than the one that triggers
>the _assign event during the _assign event execution, but
>re-assigning the same property value triggers somewhat other
>than the desired results.
>
>I wanted to check the datatype being passed in, and correct it
>if possible. Is there a safe way of doing this?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform