TcxCustomTextEditProperties.UseDisplayFormatWhenEditing Property
Specifies if the editor applies the display text formatting pattern to content in edit mode.
Declaration
property UseDisplayFormatWhenEditing: Boolean read; write; default False;
Property Value
Type | Default | Description |
---|---|---|
Boolean | False |
|
Remarks
EditFormat and DisplayFormat properties allow you to define different formatting patterns for numeric values in edit and display modes. You can set the UseDisplayFormatWhenEditing
property to True
to use the DisplayFormat pattern in both modes if the EditFormat property is unspecified.
Code Example: Display Zero as an Empty Text Box
You can use the DisplayFormat property to hide a zero value in a currency editor.
The following code example sets the third section of the value formatting pattern to an empty string so an unbound currency editor displays a blank text box for 0
and Null Variant values:
var
AProperties: TcxCurrencyEditProperties;
begin
AProperties := cxCurrencyEdit1.Properties;
AProperties.BeginUpdate; // Initiates the following batch change
try
AProperties.DisplayFormat := '$,0.00;($,0.00); '; // Changes the default formatting pattern
AProperties.UseDisplayFormatWhenEditing := True; // Applies the same pattern in edit mode
AProperties.AutoSelect := False; // Disables automatic content selection in edit mode
finally
AProperties.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
Default Value
The UseDisplayFormatWhenEditing
property’s default value is False
.