ComponentOne True DBInput Pro 8.0
Format Property (TDBText)

 

Format Property (TDBText)

Sets/returns the input mask to use in the control.

Syntax

TDBText.Format= string

Read/Write at run time and design time.

Values

The following are the keywords available in the Format property:

A

Upper case alphabet (A-Z)

a

Lower case alphabet (a-z)

9

Numbers (0-9)

#

Numbers and number related symbols (0-9, +-$%\,.)

@

Symbols

B

Binary numbers (0 or 1)

X

Hexadecimal (0-9, A-F)

K

Katakana

J

Hiragana

Z

All DBCS characters

H

All SBCS characters

Remarks

The format is specified by creating a mask using the keywords. The default is set to a zero-length string indicating all characters are available for inputting.

You can use the FormatMode property to determine if you want only the characters specified in the format string to be entered, or only the characters not in the format string to be entered. You can also determine whether to allow space input or not by setting the AllowSpace property.

The following examples demonstrate how to build format strings for data input.

TDBText1.Format = "AB"

TDBText1.FormatMode = dbiIncludeFormat

In the example above, the control will allow only upper case SBCS alphabets (A-Z) and binary numbers (0, 1).

TDBText1.Format = "AX9"

TDBText1.FormatMode = dbiIncludeFormat

In the example above, the control allows upper case SBCS alphabets (A-Z) and SBCS numbers (0-9).  The X keyword - hexadecimal will be ignored, since the "A" (A-Z) and the "9"(0-9) keyword includes the hexadecimal characters.

TDBText1.Format = "AaK9H"

TDBText1.FormatMode = dbiIncludeFormat

In the example above, the control allows all SBCS characters. The "AaK9" will be ignored, since the "H" keyword covers all SBCS characters.

TDBText1.Format = ""

TDBText1.FormatMode = dbiExcludeFormat

TDBText1.AllowSpace = True

In the example above, the control allows all characters to be inputted. This will be the default setting when the control is first created. The following example is also equivalent.

TDBText1.Format = "ZH"

TDBText1.FormatMode = dbiIncludeFormat

TDBText1.AllowSpace = True

Now the two following examples show you how to disable the control so it will not accept any character input. All characters will be filtered. Both examples are equivalent.

TDBText1.Format = ""

TDBText1.FormatMode = dbiIncludeFormat

TDBText1.AllowSpace = False

TDBText1.Format = "ZH"

TDBText1.FormatMode = dbiExcludeFormat

TDBText1.AllowSpace = False

If you set the AutoConvert property to True, all convertible characters will be automatically converted accordingly to the input mask. For example, if set the input mask to  "A", by hitting a lower case character the control automatically converts the character into an upper case. When an SBCS character is entered in a DBCS format, the entered character will be automatically converted to DBCS. The AutoConvert property tries converting as much as possible.

The maximum number of characters that can hold in the control will be determined by the MaxLength property. You can set the maximum length in byte or character base, specify using the LengthAsByte property.

The Enter and the Tab keys will be available when the MultiLine property is set to True with any input mask

The settings of this property will take effect in the drop-down edit window.

See Also

FormatMode Property (TDBText)

AutoConvert Property (TDBText)

MultiLine Property (TDBText)

MaxLength Property (TDBText)

LengthAsByte Property (TDBText)

Text Property (TDBText)

InvalidInput Event (TDBText)

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback