Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Show text in text box as help, but clear when typeing
Message
De
30/01/2012 13:57:27
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01534085
Message ID:
01534103
Vues:
62
thanks works perfectly. I abandond my version. But one problem:
hitting the enter key does not leave the control to run the code in lostfocus()
:-((
Peter


>>I want to show:
>>
>>ClaimNo./Claimant
>>
>>in a textbox as a guide to users, but as soon as the user starts typing the 'ClaimNo./Claimant' should diappear and the typed text show.
>>Tried several versions, but none is satisfying.
>>Has anyone tried that??
>>
>>Peter
>>eg:
>> textbox transparent with label underneath but since the textbox is the first one on the form it gets selected and appears opaque immediately
>
>Try:
>
>oForm = CREATEOBJECT([form1])
>oForm.Show(1)
>
>**************************************************
>*-- Form:         form1 (d:\all_zapl\additional_programs\upgrade\test.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   01/30/12 07:51:00 PM
>*
>DEFINE CLASS form1 AS form
>
>
>    DoCreate = .T.
>    Caption = "Form1"
>    starttyping = .F.
>    Name = "Form1"
>
>
>    ADD OBJECT text1 AS textbox WITH ;
>        Value = ("ClaimNo./Claimant"), ;
>        Height = 23, ;
>        Left = 162, ;
>        Top = 39, ;
>        Width = 171, ;
>        ForeColor = RGB(192,192,192), ;
>        Name = "Text1"
>
>
>    PROCEDURE text1.KeyPress
>        LPARAMETERS nKeyCode, nShiftAltCtrl
>
>        NODEFAULT 
>        IF nKeyCode > 31 AND NOT thisform.Starttyping
>           thisform.Starttyping = .t.
>           this.ForeColor = RGB(0,0,0)
>           this.Value = CHR(nKeyCode)
>           this.SelStart = 1
>           RETURN
>        ENDIF
>
>        DODEFAULT(nKeyCode, nShiftAltCtrl)
>
>        IF EMPTY(this.Value)
>           thisform.Starttyping = .f.
>           this.ForeColor = RGB(192,192,192)
>           this.Value = "ClaimNo./Claimant"
>           this.SelStart = 0
>        ENDIF
>
>        IF NOT thisform.Starttyping
>           NODEFAULT 
>        ENDIF
>    ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>**************************************************
>
>
Peter Cortiel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform