[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'MaskEdit' (#lcl)

TCustomMaskEdit.ApplyMaskToText

Applies the edit mask in the control to the specified value.

Declaration

Source position: maskedit.pp line 263

protected function TCustomMaskEdit.ApplyMaskToText(

  Value: TCaption

):TCaption;

Arguments

Value

  

Value examined and converted in the method.

Function result

Value after mask literals and space substitution is applied.

Description

ApplyMaskToText is a TCaption function used to apply the edit mask in the control to the text specified in Value. This method mimics the behavior implemented in Delphi version 3, including:

Some examples to clarify:

EditMask Text to be set Result
99 1 1_
cc-cc 1-2 1_-2_
!99 1 _1
!cc-cc 1-2 _1-_2
cc-cc@cc 1-2@3 1_-2_@3_
cc-cc@cc 12@3 12-__@3_
cc-cc@cc 123-456@789 12-45@78
!cc-cc@cc 123-456@789 23-56@89

This feature seems to have been invented for use with dates:

EditMask Text to be set Result
99/99/00 23/1/2009 23/1_/20 if your locale DateSeparator is '/'
!99/99/00 23/1/2009 23/_1/09 if your locale DateSeparator is '/'

The resulting text will always have length defined for the TInternalMask type used in the control. The new text value does not have to pass validation.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.