PC SOFT

WINDEV的在线文档

  • Numeric controls (except for the currency controls)
  • Currency controls
  • Currency + Euro Controls
  • Date controls
  • Time controls
  • DateTime controls
  • Duration controls
  • Type of display mask
  • Regular expressions in the display masks
  • Limits
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

..显示掩码 is used to:
  • Find out the display mask.
  • Modify the display mask.
This display mask is displayed when the control is in read-only or when the control does not have focus.

..显示掩码 applies to:

  • the Numeric, Currency, Date, Time and Duration edit controls.
  • the Numeric, Currency, Date, Time and Duration table columns.
  • WinDevWindows the combo boxes with or without edit.
  • WinDevWindows the table columns displayed by the combo boxes.
例子
EDT_DATE..输入掩码="DD/MM/YYYY"
EDT_DATE..显示掩码="DDD, D MMMM YYY"

WinDevWindows
// Modify the mask of the table column displayed by the combo box
COMBO_TableInput.COL_DateCol..显示掩码="DDD, the D MMMM YYY"

语法

Finding out the display mask of a control 隐藏详细信息

<Result> = <Control Name>..显示掩码
<Result>: Constant or character string
Display mask of the specified control. The display mask depends on the type of control. See notes for more details.
<Control Name>: Character string (with or without quotes)
Name of the control to use.

Modifying the display mask of a control 隐藏详细信息

<Control Name>..显示掩码 = <New Display Mask>
<Control Name>: Character string (with or without quotes)
Name of the control to use.
<New Display Mask>: Constant or character string
New display mask for the specified control. The display mask depends on the type of control. See notes for more details.
If this parameter corresponds to an empty string (""), the display mask will be identical to the input mask defined for the control.

注意

Numeric controls (except for the currency controls)

Three types of masks are available:
  1. Preset display masks
  2. Custom display masks
  3. Special custom display masks
1. Preset display masks

掩码.文件大小Numeric mask for the file size and disk size.
掩码.系统数字Numeric mask used by the system. Corresponds to the mask selected in the system regional settings ("Regional options" in the control panel).

Example:

EDT_Edit1..显示掩码=掩码.文件大小
EDT_Edit15681234

The change of unit (from KB to MB for example) is performed for each multiple of 1024. Therefore, the mask may display 1003 KB.

2. Custom display masks

The display masks are defined using the following characters: "9", ".", ",", "+" and "-", "$" and space characters.

For example: "99.999,99".

The display masks take into account the decimal separator, the thousand separator and the currency symbol defined for the language.

In programming (regardless of the language):

  • " " (space) is replaced by the thousand separator
  • "," (comma) is replaced by the decimal separator
  • "$" is replaced by the currency symbol (write "$$" to avoid this substitution)

3. Special custom display masks

  • Using the % symbol:
    The value assigned by programming to the control is multiplied by 100 and the "%" symbol is displayed.
    You can write "%%" to display the % character without multiplying the value by 100.
    Example: Assigning the control by programming
    EDT_Edit1..显示掩码="999,9%"
    EDT_Edit10.562

    EDT_Edit1..显示掩码="999,9%%"
    EDT_Edit10.562
  • Using brackets: displaying the negative numbers.
    Example:
    EDT_Edit1..显示掩码="(999 999)"
    EDT_Edit1=-1234// Displays (1 234)
    EDT_Edit11234
  • Using the - sign at the end of string: displaying negative numbers (ability to write "--" to display the - sign at the end of string)
    Example:
    EDT_Edit1..显示掩码="999 999 -"
    EDT_Edit1=-1234// Displays 1 234-
  • Multiple display mask: display mask used to define the format of positive numbers, the format of negative numbers, the value if 0 is used, the value if NULL is used. The following syntax is used:
    <Format of Positive Numbers>;<Format of Negative Numbers>;<Value if 0>;<Value if NULL>
    Example:
    EDT_Edit1..显示掩码="999 999;-999 999;0;<NULL>"
    EDT_Edit1=-1234// Displays - 1 234

    Note: You have the ability to specify a color by using [<Color>] beside the requested mask. <Color> can correspond to:
    • one of the following constants: Red, Green, Blue, Black, White, Yellow, Orange
    • an hexadecimal value in "#BBGGRR" format.
Example:
EDT_Edit1..显示掩码="999 999;-999 999[Red];0;<NULL>"
EDT_Edit1=-1234// Displays - 1 234 in red

EDT_Edit1..显示掩码="999 999;-999 999[#FF0000];0;<NULL>"
EDT_Edit1=-1234// Displays - 1 234 in blue
Note: The color specified in the display mask has priority over ..颜色. It is ignored if the control is grayed.

Notes:
  • If you want the number to be filled with zeros on the left, use the "0" character on the left of the mask. For example: "099.999,99".
  • If you want the decimal part of the number to be filled with zeros, use the character "9" on the right of the decimal point. For example, when using the "9999,99000" mask, the number 12 is displayed as "12,00" and not as "12,00000".
    However, the number "12,368" is displayed properly: its value is preserved, without being truncated or rounded.
  • To force the signs, use the "+" character on the left. For example: "+9999"

Currency controls

The display masks and the numeric masks have the same type. The difference is found in the precision: the currencies have 17 significant digits for the integer part and up to 6 digits for the decimal part.

For example: "99 999 999 999 999 999,999999".

Note: A preset mask can also be used for the Currency controls:

掩码.系统货币Currency mask used by the system. Corresponds to the mask selected in the system regional settings ("Regional options" in the control panel).

Currency + Euro Controls

The display masks and the currency masks have the same type. The dollar character ("$") can be added into the mask to display the current currency.

For example: "999,99 $" will display "250,25 E" if the current currency is the Euro.

Date controls

The display masks for the Date controls are:
  • a custom mask:
    • "JJ/MM/AAAA"
    • "DD/MM/YY"
    • "DDD DD"
    • "MM/DD/YYYY"
    • "MM/DD/YY"
    • "YYYY/MM/DD"
    • "YY/MM/DD"
    • "DD/MM/YYYY HH:MM:SS"
    • "MM/DD/YYYY HH:mm:SS"
    • "DD/MM/YYYY HH:mm:SS:CCC"
    • "MM/DD/YYYY HH:mm:SS:CCC"
    • "DDDD DD MMMM YYYY"
    • "Dddd DD Mmmm YYYY"
    • "Dddd DD Mmm YYYY"
A custom mask can include the following elements:
  • "DD" (corresponding to the day of the week in digits, for example: 12)
  • "DDDD" (corresponding day of the week, "Thursday" for example). The case used depends on the linguistic options of the project.
  • "Dddd" (corresponding to the day of the week with the first letter in uppercase, for example: Monday)
  • "dddd" (corresponding to the day of the week with the first letter in lowercase, for example: monday)
  • "DDD" (abbreviation for the day of the week, "Thu" for example). The case used depends on the linguistic options of the project.
  • "Ddd" (abbreviation for the day of the week with the first letter in uppercase, for example: Mon)
  • "ddd" (abbreviation for the day of the week with the first letter in lowercase, for example: mon)
  • "MM" (month in digits, for example: 12)
  • "MMMM" (month spelled out, "January" for example). The case used depends on the linguistic options of the project.
  • "Mmmm" (month spelled out with the first letter in uppercase, for example: January)
  • "mmmm" (month spelled out with the first letter in lowercase, for example: january)
  • "MMM" (abbreviation of the month, "Jan" for example). The case used depends on the linguistic options of the project.
  • "Mmm" (abbreviation of the month with the first letter in uppercase, for example: Jan)
  • "mmm" (abbreviation of the month with the first letter in lowercase, for example: jan)
  • "YYYY" (year on four digits, "2001" for example)
  • "YY" (last two digits of the year, "01" for example)

  • a constant corresponding to a preset mask:
    18版本和更高版本
    掩码.相对持续时间日期
    18新版本
    掩码.相对持续时间日期
    掩码.相对持续时间日期
    Mask used to express the duration passed (or the future duration) between the date of the day and the specified date. This mask is expressed in natural language. The different formulations used can be configured in the project description for the current language:
    1. On the "项目" pane, in the "项目" group, click "描述".
    2. In the "Languages" tab:
      • select the language to configure.
      • select the "Date" tab.
    3. Click the "Dates and Times in natural language" button.
    4. Define (if necessary) the custom captions to use. These captions will be used:
    16版本和更高版本
    掩码.电子邮件日期
    16新版本
    掩码.电子邮件日期
    掩码.电子邮件日期
    Mask corresponding to the data format of the RFC-5322 standard used to encrypt an email, a RSS stream, ...
    掩码.系统日期System mask, defined in the project description for the current language ("Project .. Project description", "Languages" tab).

    System mask defined in the project description for the current language:
    1. On the "项目" pane, in the "项目" group, click "描述".
    2. Select the "Languages" tab then the "Date" tab.
    3. The format used corresponds to:
      • the parameters of the operating system,
      • the specified parameters (with the defined days and months).
These masks can be combined. For example: "Ddd DD Mmmm YYYY at HH:mm" will return a result in the following format: "Thu 01 February 1979 at 21:35".

Time controls

The display masks for the Time controls are:
  • "HH:MM"
  • "HH h MM"
  • "HH:MM:SS"
  • "HH:MM:SS AM": Used to manage the time in AM/PM format.
  • "HH:MM:SS:CC"
  • The preset mask corresponds to the system time. The system time depends on the mask selected in the regional system setings ("Regional options" in the control panel).
    掩码.系统时间Mask used by the system for the time.

DateTime controls

To specify a DateTime display mask, you must:
  1. Switch the type of the control (or table column) to Date ("Details" tab in the description window of the control or column).
  2. Modify the display mask of this control or column ("Details" tab in the description window of the control or column, or ..显示掩码).

Duration controls

The following elements can be used to define a custom mask (case sensitive). To present the custom masks, let's take a duration equal to 0 day 04 hours 15 minutes 03 seconds and 412 thousandths of a second:
  • +1: only the most significant unit will be displayed (the number of hours in our example).
  • +2: only the two most significant units will be displayed (the number of hours and the number of minutes in our example).
    Specify '+3' or '+4' to display the three or four most significant units.
  • D: the number of days will be displayed if this number is greater than 0 (the number of days will not be displayed in our example).
  • H: the number of hours will be displayed if this number (or if the number of days) is greater than 0. If this number contains a single digit, this digit will be displayed (the number of hours will be '4' in our example).
  • HH: the number of hours will be displayed if this number (or if the number of days) is greater than 0. If this number contains a single digit, this digit will be preceded by '0' (the number of hours will be '04' in our example).
  • M: the number of minutes will be displayed if this number (or the number of days, or the number of hours) is greater than 0. If this number contains a single digit, this digit will be displayed (the number of minutes will be '15' in our example).
  • MM: the number of minutes will be displayed if this number (or the number of days, or the number of hours) is greater than 0. If this number contains a single digit, this digit will be preceded by '0' (the number of minutes will be '15' in our example).
  • S: the number of seconds will be displayed if this number (or if the number of days, or the number of hours, or the number of minutes) is greater than 0. If this number contains a single digit, this digit will be displayed (the number of seconds will be '3' in our example).
  • SS: the number of seconds will be displayed if this number (or if the number of days, or the number of hours, or the number of minutes) is greater than 0. If this number contains a single digit, this digit will be preceded by '0' (the number of seconds will be '03' in our example).
  • CC: the number of hundredths of a second will be displayed (the number of hundredths of a second will be '41' in our example).
  • CCC: the number of thousandths of a second will be displayed (the number of thousandths of a second will be '412' in our example).
Note: If the separator corresponds to the ":" character, the letter corresponding to the most significant unit will be added ('h' for hour, 'm' for minute, 's' for second, 'cs' for hundredths of a second and 'ms' for thousands of a second).

Type of display mask

A mask can be replaced by a mask of the same type. For example, the display mask of a DATE control cannot be replaced by the display mask of a TIME control.

Assigning an incorrect display mask will trigger an error message.

Regular expressions in the display masks

The regular expressions used in this property must not be the ones used in 检查正则表达式.

In the display masks, the regular expressions are used to prevent from typing some specific characters or a sequence of characters.

In 检查正则表达式, the regular expressions are used to check whether a string complies with a format.

Example: Checking whether the T1 string contains a letter and a digit:

  • with 检查正则表达式: the regular expression is [A-Za-z][0-9]
  • with ..显示掩码: the regular expression is [A-Za-z]{0,1}[0-9]{0,1}

Limits

In a window, ..显示掩码 only applies to the:
  • Numeric, Currency, Date, Time and Duration edit controls,
  • Numeric, Currency, Date, Time and Duration table columns,
  • groups of edit controls,
  • WinDevWindows combo boxes with or without edit.
  • WinDevWindows table columns displayed by the combo boxes.