Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing value in Destroy()
Message
 
 
À
17/01/1999 15:42:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00177015
Message ID:
00177020
Vues:
49
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.

>I am creating a control derived from the textbox class which displays a prompt as the value of the control until the user enters the required text. Then the prompt is replaced with the actual text.
>
>If the user does not enter any text, the prompt remains in value.
>
>I need to clean this up when the textbox is destroyed so it is not saved to the linked controlsource field.
>
>The problem I am having is that Destroy() does not allow the value to be changed during the destroy() process (good sense, actually). So I need to find a method or event which is a good location for text to clean up the prompt text, replacing it with blank.
>
>I can easily do this in the continer's destroy method by parsing the .controls colleciton, identifying any textboxes of the derived type and setting their value to empty if the value text == the prompt text. But I would like this textbox to be self-contained.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform