Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fsize()
Message
De
02/11/1999 13:37:46
 
 
À
02/11/1999 09:30:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00285443
Message ID:
00285595
Vues:
19
Hi Mike.

>> I'd like to be able to set an inputmask on "Numeric" fields using <<

Does this work for you?
LOCAL lcAlias, lcField, lcType, laFields[1], ;
      lnElement, lnRow, lcIntegerPart, lcDecimalPart

WITH This
  IF ! EMPTY( .ControlSource )
    IF EMPTY( .InputMask )
	*** Only set the inputmask for numeric and character fields
	*** and check the data type of the underlying field so we
	*** can set it appropriately
	lcType = TYPE( This.ControlSource )
	IF INLIST( lcType, 'C', 'N' )
 	  *** Parse the alias and the field name from the ControlSource
	  lcAlias    = JUSTSTEM( .ControlSource )
	  lcField    = JUSTEXT ( .ControlSource )
	  *** Don't attempt to check the properties of the underlying
	  *** field if we are bound to a form property
	  IF UPPER( lcAlias ) # 'THISFORM'
	    *** format the field if it is character
	    IF lcType = 'C'
		.InputMask = REPLICATE( 'X', FSIZE( lcField, lcAlias ) )
	    ELSE
		AFIELDS(laFields, lcAlias)
		lnElement = ASCAN(laFields, UPPER(lcField))
		IF lnElement > 0
		   lnRow = ASUBSCRIPT(laFields, lnElement, 1)
		   lcIntegerPart = REPLICATE('9', laFields[lnRow, 3] - laFields[lnRow, 4] - 1)
		   lcDecimalPart = REPLICATE('9', laFields[lnRow, 4])
		   .InputMask = lcIntegerPart + '.' + lcDecimalPart
		ENDIF
    	    ENDIF
	 ENDIF
      ENDIF	
    ENDIF
  ENDIF
ENDWITH			
Marcia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform