Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing value in Destroy()
Message
From
17/01/1999 18:06:49
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00177015
Message ID:
00177027
Views:
54
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform