PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of InputMask variables
  • Use
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The InputMask type is used to define all the advanced characteristics of a custom input mask. The characteristics of this custom input mask can be defined and modified 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.
Versions 26 and later
Linux This function is now available for WINDEV applications in Linux.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 26
Linux This function is now available for WINDEV applications in Linux.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
iPhone/iPad This function is now available for iPhone/iPad applications.
Linux This function is now available for WINDEV applications in Linux.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
iPhone/iPad This function is now available for iPhone/iPad applications.
Example
m_sMask is string = "99 99 99 99 99"
CustomMask is InputMask
CustomMask.FormatDuringInput = FormatDuringInput
CustomMask.ValidateDuringInput = ValidateDuringInput
CustomMask.ValidateDuringExit = ValidateDuringExit
CustomMask.FormatDuringExit = FormatDuringExit
CustomMask.FormatDuringEntry = FormatDuringEntry
CustomMask.FormatDuringAssignment = FormatDuringAssignment
CustomMask.CheckIfValidInput = CheckIfValidInput
 
EDT_Phone.InputMask = CustomMask
 
INTERNAL PROCEDURE FormatDuringInput(LOCAL sTextBefore is string,
LOCAL nCursorBefore is int, ...
LOCAL nEndCursorBefore is int, ...
sTextAfter is string, ...
nCursorAfter is int, ...
nEndCursorAfter int)
IF Length(sTextBefore) > Length(sTextAfter) THEN RESULT
//No action if deleting
// if at the end
IF nEndCursorAfter = Length(sTextAfter) +1 THEN
// include " " if needed at this location
IF Middle(m_sMask, nEndCursorAfter, 1) = " " THEN
sTextAfter += " "
nEndCursorAfter ++
nCursorAfter = nEndCursorAfter
END
END
END
 
INTERNAL PROCEDURE ValidateDuringInput(sText is string): boolean
RESULT MatchRegularExpression(sText , "[0-9 ]*")
END
 
INTERNAL PROCEDURE CheckIfValidInput(sText is string): boolean
RESULT ValidateDuringInput(sText) _AND_ Length(sText) >= 3
END
 
INTERNAL PROCEDURE FormatDuringAssignment(sText_INOUT is string)
FormatStringToPhoneNumber(sText_INOUT)
END
 
INTERNAL PROCEDURE ValidateDuringExit(sText is string): boolean
IF Length(sText) < 3 THEN
ToastDisplay("3 characters minimum")
RESULT False
END
RESULT True
END
 
INTERNAL PROCEDURE FormatDuringExit(sText_INOUT is string)
FormatStringToPhoneNumber(sText_INOUT)
END
 
INTERNAL PROCEDURE FormatDuringEntry(sText_INOUT is string)
FormatStringToPhoneNumber(sText_INOUT)
END
 
INTERNAL PROCEDURE FormatStringToPhoneNumber(sText_INOUT is string)
// group numbers like in the mask
sText_INOUT = Replace(sTexte_INOUT," ","")
sResult is string
nPosSrc is int = 1
FOR I = 1 _TO_ Length(m_sMask)
// depending on the character in the mask
SWITCH Middle( m_sMask, I, 1)
CASE " "
sResult += " "
OTHER CASE
// keep the entered character
sResult += Middle(sText_INOUT, nPosSrc, 1)
nPosSrc++
END
END
sText_INOUT = sResult
END
Remarks

Properties specific to the description of InputMask variables

The following properties can be used to manipulate a custom input mask:
Property nameType usedEffect
Versions 26 and later
FormatDuringAssignment
New in version 26
FormatDuringAssignment
FormatDuringAssignment
WLanguage procedureName of the WLanguage procedure that transforms the text assigned programmatically into text to be displayed.
This procedure has the following format:
PROCEDURE <Procedure name>(<Text> string)
where <Text> corresponds to the text to handle.
If this property is not specified, no transformation is performed.
FormatDuringEntryWLanguage procedureName of the WLanguage procedure that transforms the displayed text into input text.
This procedure has the following format:
PROCEDURE <Procedure name>(<Text> string)
where <Text> corresponds to the text to handle.
If this property is not specified, no transformation is performed.
FormatDuringInputWLanguage procedureName of the WLanguage procedure that transforms the text during input.
This procedure has the following format:
PROCEDURE <Procedure name>(LOCAL<Text before> string,
LOCAL <Cursor before> int,
LOCAL <End Cursor before> int,
<Text after> string, <Cursor after> int,
<End Cursor after> int)
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.
FormatDuringExitWLanguage procedureName of the WLanguage procedure that transforms the input text into displayed text.
This procedure has the following format:
PROCEDURE <Procedure name>(<Text> string)
where <Text> corresponds to the text to handle.
If this property is not specified, no transformation is performed.
ValidateDuringInputWLanguage procedureName 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 <Procedure name>(<Text> string)
where <Text> corresponds to the text to handle.
If this property is not specified, no transformation is performed.
ValidateDuringExitWLanguage procedureName 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.
Versions 26 and later
This procedure will be called when leaving the control only if blocking input validation is enabled. For more details, see Required or invalid input in WINDEV.
New in version 26
This procedure will be called when leaving the control only if blocking input validation is enabled. For more details, see Required or invalid input in WINDEV.
This procedure will be called when leaving the control only if blocking input validation is enabled. For more details, see Required or invalid input in WINDEV.
This procedure has the following format:
PROCEDURE <Procedure name>(<Text> string)
where <Text> corresponds to the text to handle.
If this property is not specified, no transformation is performed.
Versions 26 and later
CheckIfValidInput
New in version 26
CheckIfValidInput
CheckIfValidInput
WLanguage procedureName of the WLanguage procedure called by InvalidInputDetect and InvalidInputListControl to determine if the text entered is valid.
This procedure has the following format:
PROCEDURE <Procedure name>(<Text> string)
where <Text> corresponds to the text to handle.
If this property is not specified, no check 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.
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment