TMlSkinDatetimePicker

A date/time picker: clicking it drops down a calendar panel, optionally with a time selector.

Category
Edits & pickers
Unit
uMlSkinDatetimePicker.pas
Inherits from
TMlSkinEdit → TMlSkinPngEdit → TMlSkinCustomControl

Notes

  • Kind chooses date only (tkDate) or date and time (tkDateTime).
  • Read the result from Date and Time; Format controls how it is displayed.
  • MinDate and MaxDate restrict the selectable range.
  • The Define...Text properties relabel the dropdown panel (weekday names, Today, OK and so on), which is what you need for a localized UI.
  • With AutoClose on the panel closes as soon as a day is picked; with it off the user confirms, which suits picking a date and then a time.

Example

From the demo MlSkin.MainDemo.v3.0 (.dfm form file)

object dp1: TMlSkinDatetimePicker
  Left = 781
  Top = 148
  Width = 145
  Height = 26
  Cursor = crIBeam
  FontHint.Charset = DEFAULT_CHARSET
  FontHint.Color = 11711154
  FontHint.Height = -11
  FontHint.Name = 'Tahoma'
  FontHint.Style = []
  BorderNormal = 'MlSkinBorderNormal'
  BorderHot = 'MlSkinBorderHot'
  EdItems = <
  ...

Properties 30

NameTypeDefaultDescription
AutoCloseBooleanTrueCloses the dropdown as soon as a day is picked. With it off the user confirms with OK, which suits picking a date and a time together.
KindTMlDateTimeKindtkDateTimeWhat can be picked: tkDate for a date only, tkDateTime for date and time.
Formatstring—Display format string, for example yyyy-mm-dd.
DateTDate—The selected date.
TimeTTime—The selected time, used when Kind is tkDateTime.
MaxDateTDate—Latest selectable date.
MinDateTDate—Earliest selectable date.
DefineHourTextstring—Label for "hour" on the dropdown panel, for localization.
DefineMinuteTextstring—Label for "minute" on the dropdown panel.
DefineSecondsTextstring—Label for "second" on the dropdown panel.
DefineClearTextstring—Caption of the Clear button on the dropdown panel.
DefineTodayTextstring—Caption of the Today button on the dropdown panel.
DefineOKTextstring—Caption of the OK button on the dropdown panel.
DefineTimeTextstring—Label for "time" on the dropdown panel.
DefineSuTextstring—Label for Sunday.
DefineMoTextstring—Label for Monday.
DefineTuTextstring—Label for Tuesday.
DefineWeTextstring—Label for Wednesday.
DefineThTextstring—Label for Thursday.
DefineFrTextstring—Label for Friday.
DefineSaTextstring—Label for Saturday.
FontHintTFont—Font of the placeholder text, usually lighter than the main text.
BorderNormalTMlResID—Border image in the normal state, given as an image ID or path.
BorderHotTMlResID—Border image used on hover or while focused.
ReadOnlyBooleanFalseRead-only: the content cannot be edited, but it can still be selected and copied.
Textstring—The text shown or typed in the control.
TextHintstring—Placeholder text shown in a light color while the control is empty, for example "Type a keyword".
MaxLengthInteger0Maximum number of characters; 0 means no limit.
EdItemsTMlEditItems—The items inside the edit: each has its images (normal, hot, pressed), text, position and visibility — this is how clear, search or reveal-password buttons are built.
SpaceTMlSpaceSize—Padding between the text and the border (left, top, right, bottom); switch its Active on first.

Events 2

NameTypeDefaultDescription
OnChangeTNotifyEvent—Fires when the content changes.
OnPickDoneTNotifyEvent—Fires once the selection is finished, either by confirming or by auto-closing.
Properties of TMlSkinEdit 6
NameTypeDefaultDescription
AutoSelectBooleanTrueSelects the existing text automatically when the control receives focus.
ShowCheckBoxBooleanFalseShows a check box at the left of the edit; its state is read and written through Checked.
CharCaseTEditCharCaseecNormalLetter case conversion: as typed, upper case or lower case.
CheckedBooleanFalseThe checked state.
BorderVisibleBooleanTrueWhether the border is drawn.
TextKindTMlTextKindtkAllRestricts what can be typed: tkAll anything, tkEN letters, tkNumInt integers, tkNumReal numbers with decimals and sign, tkENandNum letters and digits.
Properties of TMlSkinPngEdit 3
NameTypeDefaultDescription
TextHintHideInKeyBooleanFalseWhen the placeholder disappears: with this on it stays while focused and hides only once a character is typed.
CursorColorTColorclBlackColour of the caret.
DisableIMEBooleanFalseDisables the IME so only Latin letters and digits can be typed — useful for account or serial number fields.
Properties of TMlSkinCustomControl 5
NameTypeDefaultDescription
AboutTMlAboutInfo—A design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm.
TransparentBooleanTrueTransparent background: the control skips its own fill and shows the form background (image or color) instead.
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
AutoInvalidateBooleanFalseRepaints automatically when the content changes. Turn it on if property changes do not show up.
EraseBackgroundBooleanFalseWhether the background is erased before painting; worth toggling if the control flickers.
Events of TMlSkinCustomControl 4
NameTypeDefaultDescription
OnDPIChangedTMlDPIChangedEvent—Fires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself.
OnBackgroundChangingTMlBackgroundEvent—Fires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEvent—Fires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEvent—Fires when the control is shown or hidden.

Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.

Offline helpA PDF / CHM version is available for offline reading.