Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TxtBox KeyPress Event
Message
De
15/05/1998 01:29:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/05/1998 15:54:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00099565
Message ID:
00099658
Vues:
22
>In the keypress event of a textbox I put :
>
>------------------------------------------------------------------
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>NODEFAULT
>local lnant_start
>
>if nKeyCode = 45
> lnant_start = this.SelStart
> this.SelStart = 0
> this.SelLength = lnant_start
> this.SelText = transform(val(left(alltrim(str(val(this.SelText))), 4)), "@L 9999")
> this.SelStart = 4
>endif
>
>dodefault()
>-------------------------------------------------------------------
>
>This.inputmask = 9999-99999999
>This.Width = 14
>This.MaxLength = 12
>This.ControlSource = myfile.myfield (Numeric 12)
>
>The idea is to fill with 0's the beginning of the first 4 characters when the user presses '-'.
>When I run the form the code does it's work OK but when I press < ENTER> nothing happens.
>
>Any ideas???
Just change the code a little bit :
>LPARAMETERS nKeyCode, nShiftAltCtrl

local lnant_start

if nKeyCode = 45
NODEFAULT
	lnant_start = this.SelStart
	this.SelStart = 0
	this.SelLength = lnant_start
	this.SelText = transform(val(left(alltrim(str(val(this.SelText))), 4)), "@L 9999")
	this.SelStart = 4
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform