Using the Date Picker Control

From RAD Studio
Jump to: navigation, search

Go Up to VCL

TDatePicker allows the user to select a date value from a dropdown, changing the day, month, and year values separately. The user can change the selection with the keyboard arrow keys, clicking with the mouse on the upper or lower elements of a list or on the top and bottom arrows, or using the mouse wheel.

You can customize the control by changing the date format (affecting the sequence of display of the 3 elements), the date selection dropdown count, the minimum and maximum year values, and the display of ok and cancel buttons.

TDatePicker fully supports VCL styling for Windows 10 and previous versions of Windows.


Configure Properties

TDatePicker allows you to configure the following main properties:

  • The Date property allows you to set the initial date you want to display in the control.
  • The DateFormat property allows you to establish the format in which you want to display the date. You can customize the sequence in which the CalendarPicker displays the elements (month/day/year vs. day/month/year, vs year/month/day, etc.). You can use double letters for month and day to show an initial 0 for single digit elements. Use yyyy to display the complete year value or yy to display only the last two digits of a year value. Use mmm to display the first three letters of each month in text or use mmmm to display the complete name of the month. Use the same approach for dd values.
  • The DropDownCount property allows you to set a number of options to display in the dropdown.
  • The MaxYear property allows you to set the final year.
  • The MinYear property allows you to set the initial year.
  • The Color, HighlightColor, PopupColor, SelectionColor, and SelectionFontColor properties allow you to set a custom color scheme.
  • The Font property allows you to customize font settings.

TDatePicker properties.png

Changing Styles

TDatePicker allows you to set custom styles. You can choose from a variety of VCL Styles and apply a selected style in a few steps:

  1. Click Options in the Project menu to open the Project Options dialog box.
  2. Click Application in the left-hand panel and select Appeareance.
  3. Select a style from the list of Custom Styles and click OK.

TDatePicker styles.png

See Also