Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing value in Destroy()
Message
De
17/01/1999 18:06:49
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00177015
Message ID:
00177027
Vues:
52
>James,
>
>The value is committed to the ControlSource in the baseclass Textbox::Valid() behavior.
>
>You might try:
>
>nodefault
>this.Value = strtran( this.Value, "Prompt", "" )
>TexbBox::Valid()
>this.Value = "Propmt" + this.Value
>
>You may have to unbind these controls as far as VFP is concerned and bind them yourself. I have a txtInches class that lets the user enter 24 5/8 as a string but it gets stored numeric as 24.625. I added a custom property mcControlSource at Init() it gets set to ControlSource and ControlSource is cleared to unbind it, I do a REPLACE in the Valid method. The Refresh() method does the numeric->string conversion.

David,

I have used much the same approach. Prompt text is assigned to .value if the value is empty() on refresh(), and the forecolor is changed to alert the user that the displayed "value" is just a prompt.

I am reluctant to unbind the controlsource because it would interfere with some rollback features built into my container and form classes.

Since I already have the field identified and stored in a property, could I not just replace the field in the destroy() event? Something like,
WITH this
    IF ALLTRIM(.value) = .promptext
        SELECT (.controlsource)
        REPLACE (.controlsourcefield) WITH ""
    ENDIF
ENDWITH
I am not sure of the consequences of replacing the field directly -- would it be overwritten by some subsequent action of the destroy() method?

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform