Skip to main content

TcxCustomDateEditProperties.DateButtons Property

Specifies additional visible buttons in the date editor‘s drop-down calendar.

Declaration

property DateButtons: TDateButtons read; write;

Property Value

Type Description
TDateButtons

The current set of additional visible buttons in the drop-down calendar.

Remarks

The date editor‘s drop-down window can display Clear, Now[1], and Today buttons in addition to OK and Cancel[2] buttons.

VCL Editors Library: All Date Editor Buttons

You can use the DateButtons property to hide or display these additional buttons.

Property Values

The DateButtons property value can include btnClear, btnNow, and btnToday flags in any combination. Assigned flags correspond to individual additional buttons[1] in the date editor’s drop-down calendar.

Additional Buttons

Clear
Clears the date editor. Its Date property value changes to NullDate.
Now

Sets the current date and time obtained from the operating system.

The Now button can be visible only if the editor allows users to modify both date and time values (the Kind property is set to ckDateTime).

Today

Sets the current date obtained from the operating system. If the editor displays time (the Kind property is set to ckDateTime), the time does not change.

If the ShowToday property is set to True and the modern calendar View is active, users can also click the Today link to navigate to the current date and select it in the drop-down calendar.

Note

If the ShowOnlyValidDates property is set to True, Today and Now buttons are disabled if the current date is not within the range between MinDate and MaxDate property values.

Code Example: Add All Optional Calendar Buttons

The following code example displays all additional buttons in the date editor‘s drop-down calendar:

  cxDateEdit1.Properties.Kind := ckDateTime;  // Allows users to edit both date and time
  cxDateEdit1.Properties.DateButtons := cxDateEdit1.Properties.DateButtons + [btnToday];
  cxDateEdit1.Properties.DateButtons := cxDateEdit1.Properties.DateButtons + [btnNow];

Default Value

The DateButton property’s default value depends on Kind and View property values:

Editable Date and Time
If the editor allows users to modify both date and time values (the Kind property is set to ckDateTime), the DateButton property’s default value is [btnClear, btnNow] regardless of the View property value.
Editable Date

If the editor allows users to modify only the displayed date, the DateButton property’s default value depends on the active editor View:

Classic View
The DateButton property’s default value is [btnClear, btnToday] when the Classic View is active (the View property is set to cavClassic).
All Other Views
The DateButton property’s default value is [btnClear] in all date editor Views except Classic.
Footnotes
  1. The Now button is unavailable if the Kind property is set to ckDate (default).

  2. The Cancel button is visible only when the touch-friendly date editor View is active (the View property is set to cavTouchUI).

See Also