|
|
|
|
- Properties specific to InputMask variables
- Use
InputMask (Type of variable) In french: MasqueSaisie
The InputMask type is used to define all the advanced characteristics of a custom input mask. You can define and change the characteristics of this custom input mask using different WLanguage properties. Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
sMasque is string = "99 99 99 99 99"
MasquePerso is InputMask
MasquePerso.FormatOnInput = FormateEnSaisie
MasquePerso.ValidateOnInput = ValideEnSaisie
MasquePerso.ValidateOnExit = ValideEnSortie
MasquePerso.FormatOnExit = FormateEnSortie
MasquePerso.FormatOnEntry = FormateEnEntrée
MasquePerso.FormatOnAssignment = FormateEnAffectation
MasquePerso.CheckIfValidInput = VérifieSiSaisieValide
SAI_Téléphone.MasqueSaisie = MasquePerso
INTERNAL PROCÉDURE FormateEnSaisie(LOCAL sTexteAvant is string,
sTexteApres is string, ...
nCurseurApres is int, ...
nFinCurseurApres int)
IF Length(sTexteAvant) > Length(sTexteApres) THEN RETURN
IF nFinCurseurApres = Length(sTexteApres) + 1 THEN
IF Middle(sMasque, nFinCurseurApres, 1) = " " THEN
sTexteApres += " "
nFinCurseurApres ++
nCurseurApres = nFinCurseurApres
END
END
END
INTERNAL PROCÉDURE ValideEnSaisie(sTexte is string): boolean
RETURN MatchRegularExpression(sTexte, "[0-9 ]*")
END
INTERNAL PROCÉDURE VérifieSiSaisieValide(sTexte is string): boolean
RETURN ValideEnSaisie(sTexte) _AND_ Length(sTexte) >= 3
END
INTERNAL PROCÉDURE FormateEnAffectation(sTexte_INOUT is string)
FormateChaîneEnNuméroTéléphone(sTexte_INOUT)
END
INTERNAL PROCÉDURE ValideEnSortie(sTexte is string): boolean
IF Length(sTexte) < 3 THEN
ToastDisplay("Au moins 3 caractères")
RETURN False
END
RETURN True
END
INTERNAL PROCÉDURE FormateEnSortie(sTexte_INOUT is string)
FormateChaîneEnNuméroTéléphone(sTexte_INOUT)
END
INTERNAL PROCÉDURE FormateEnEntrée(sTexte_INOUT is string)
FormateChaîneEnNuméroTéléphone(sTexte_INOUT)
END
INTERNAL PROCÉDURE FormateChaîneEnNuméroTéléphone(sTexte_INOUT is string)
sTexte_INOUT = Replace(sTexte_INOUT," ","")
sResultat is string
nPosSrc is int = 1
FOR I = 1 _TO_ Length(sMasque)
SWITCH Middle( sMasque, I, 1)
CASE " "
sResultat += " "
OTHER CASE
sResultat += Middle(sTexte_INOUT, nPosSrc, 1)
nPosSrc++
END
END
sTexte_INOUT = sResultat
END
Remarks Properties specific to InputMask variables The following properties can be used to handle a custom input mask: | | | Property name | Type used | Effect |
---|
CheckIfValidInput | WLanguage procedure | Name of the WLanguage procedure called by InvalidInputDetect and InvalidInputListControl to determine if the text entered is valid.This procedure has the following format: PROCEDURE <Nom de la procédure>(<Texte> chaîne) where <Text> corresponds to the text to handle. If this property is not specified, no check is performed. | FormatDuringAssignment | WLanguage procedure | Name of the WLanguage procedure that transforms the text assigned programmatically into text to be displayed.This procedure has the following format: PROCEDURE <Nom de la procédure>(<Texte> chaîne) where <Text> corresponds to the text to handle. If this property is not specified, no transformation is performed. | FormatDuringEntry | WLanguage procedure | Name of the WLanguage procedure that transforms the displayed text into input text.This procedure has the following format: PROCEDURE <Nom de la procédure>(<Texte> chaîne) where <Text> corresponds to the text to handle. If this property is not specified, no transformation is performed. | FormatDuringExit | WLanguage procedure | Name of the WLanguage procedure that transforms the input text into displayed text. This procedure has the following format: PROCEDURE <Nom de la procédure>(<Texte> chaîne) where <Text> corresponds to the text to handle. If this property is not specified, no transformation is performed. | FormatDuringInput | WLanguage procedure | Name of the WLanguage procedure that transforms the text during input.This procedure has the following format: PROCEDURE <Nom de la procédure>(LOCAL <Texte avant> chaîne, LOCAL <Curseur avant> entier, LOCAL <Fin Curseur avant> entier, <Texte après> chaîne, <Curseur après> entier, <Fin Curseur après> entier) where: - <Text before> corresponds to the text before input.
- <Cursor before> corresponds to the position of the cursor before input.
- <End cursor before> corresponds to the end position of the cursor before input.
- <Text after> corresponds to the text after input.
- <Cursor after> corresponds to the position of the cursor after input.
- <End cursor after> corresponds to the end position of the cursor after input.
If this property is not specified, no transformation is performed. | ValidateDuringExit | WLanguage procedure | Name of the WLanguage procedure that checks the input (once all the characters have been entered). This procedure returns False if the text entered contains invalid characters. This procedure has the following format: PROCEDURE <Nom de la procédure>(<Texte> chaîne) where <Text> corresponds to the text to handle. If this property is not specified, no transformation is performed. | ValidateDuringInput | WLanguage procedure | Name of the WLanguage procedure that checks the current input. This procedure returns False if the text being entered contains invalid characters. This procedure has the following format: PROCEDURE <Nom de la procédure>(<Texte> chaîne) where <Text> corresponds to the text to handle. If this property is not specified, no transformation is performed. |
Use - An InputMask variable can be assigned to the InputMask property to control each event linked to the management of a mask in an edit control.
- MaskPhoneNumber and MaskZipCode handle InputMask variables.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|