TMSFMXNativeUIDatePicker class implements an object that uses multiple rotating wheels to
allow users to select dates and times. iPhone examples of a date picker are the Timer and Alarm (Set Alarm) panes of the Clock application. You may also use a date picker as a countdown timer.
||This property (in seconds) is only used to display a number when the
Mode is set to
dpmDatePickerModeCountDownTimer. It does not actually count down. This requires manual implementation.
||The datetime displayed by the DatePicker.
||The maximum datetime that a DatePicker can show.
||The minimum datetime that a DatePicker can show.
||The interval at which the DatePicker should display minutes.
||The value of this property indicates the mode of a DatePicker. It determines whether the DatePicker allows selection of a date, a time, both date and time, or a countdown time. The default mode is
||Shows / hides the DatePicker.
||Returns a reference to the native iOS
|NSDateToDate(ADateTime: NSDate): TDateTime;
TDateTime from a native iOS
||Event called when a date / value has changed.
Mode property set to
dpmDatePickerModeCountDownTimer the DatePicker can be set to a
countdown timer. Additionally the amount of seconds to countdown from needs to be set with the
In the sample below, the DatePicker is set to a countdown duration of 60 seconds. The user can select an amount of countdown seconds from which to start from.
TMSFMXNativeUIDatePicker1.Mode := dpmDatePickerModeCountDownTimerl;
TMSFMXNativeUIDatePicker1.CountDownDuration := 60;
FDuration := 60;
OnValueChanged event is triggered when the user changes the value on the countdown wheel.
To actually use it as a timer, a
procedure TForm1.TMSFMXNativeUIDatePicker1ValueChanged(ASender: TObject;
FDuration := TMSFMXNativeUIDatePicker1.CountDownDuration;
TTimer component is used to start counting down from the value chosen by the user. The timer can be used to, as an example, update a label.
procedure TForm1.Timer1Timer(Sender: TObject);
FDuration := FDuration - 1;
TMSFMXNativeUILabel1.Text := 'Seconds left = ' + floattostr(FDuration);