Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting trailing spaces in textbox control
Message
De
29/03/2001 21:25:48
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00489758
Message ID:
00490161
Vues:
13
Nadya,

>you still have a workaround using a KeyPress method, but it would be akward... :(

it got it! and it's (finally) pretty simple. I count trailing spaces in the KeyPress method, then adjust the string in the valid. Here it is, w/a bit of initialization, etc. in other places:

In KeyPress:
WITH THISFORM
  IF CHR( m.nKeyCode ) = " "	&& user entered space
    IF .lLastWasSpace
      .nTrailingSpaces = .nTrailingSpaces + 1 && found consecutive spaces, count this one
    ELSE
      .nTrailingSpaces = 1 && found a space after a non-space, count and reest flag
      .lLastWasSpace = .T.
    ENDIF
  ELSE	&& not a space - forget counting
    .lLastWasSpace = .F.
  ENDIF
ENDWITH

In Valid:
** get characters actually typed, including trailing spaces
.cCharsEntered = RTRIM( This.Value )
IF .lLastWasSpace && last printable character user typed was a space
  .cCharsEntered = .cCharsEntered + SPACE( .nTrailingSpaces ) && put spaces back
ENDIF
Thanks for your interest and input...it's great to have a place like this to help work through things....J
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform