Livecode Wiki
Advertisement

Allows the user to select the date, time or both the date and time (iOS Only) using the native device date picker.Syntax:

mobilePickDate [<style>] [, <current>] [, <start>] [, <end>] [, step] [, buttons]

Examples:

mobilePickDate "date"
mobilePickDate "time",,,,10
mobilePickDate "time",,,,10, "cancelDone"
on displayDate
   local tSelected, tRangeStart, tRangeEnd, tInterval, tDateResult

Allows the user to select the date, time or both the date and time (iOS Only) from the native date picker on the mobile device.

Use the mobilePickDate command to display a native date-picker-wheel on iOS or a native date picker dialog on Android. They allow the user to select the date, the time or both the date and time (iOS Only).

On the iPhone, a standard Action Sheet pops up containing the standard date-picker-wheel user interface element. On the iPad, a standard pop-over is presented with a list to choose from.

There are three modes of operation of the mobilePickDate command, depending on the value of style. If style is set to "date" the date picker allows the user to select a date, starting from the current date or a parameter set date. If style is set to "time" the date picker allows the user to select a time, starting from the current time or a parameter set time. If style is set to "dateTime" (iOS Only) the date picker allows the user to select a date and time, starting from the current date and time or a parameter set date and time.

Parameters:

  • style (enum): Indicates the mode of mobilePickDate. It determines whether mobilePickDate allows selection of "date", "time" or "dateTime" (iOSOnly). The default style on iOS is "dateTime". The default style onAndroid is "date"
  • "datetime" (default on iOS) (iOS only): display a native picker to choose the date and time
  • "date" (default on Android): display a native picker to choose the date
  • "time": display a native picker to choose the time
  • current: The date, time or date and time that is to be displayed. If this is empty, then the current date time is used. If this value is set, then it must be specified in seconds.
  • start: The start range of the date picker. If this value is empty, there is no lower boundary. The value is ignored if start is greater than end. If this value is set then it must be specified in seconds. Start and end parameters will be ignored on Android when picking 'time'.
  • end: The end range of the date picker. If this value is empty, there is no upper boundary. The value is ignored if start is greater than end.If this value is set then it must be specified in seconds. Start and end parameters will be ignored on Android when picking 'time'.
  • step (iOSOnly): Specifies the minute interval size. This parameter is ignored if style is set to "date". The default is 1.
  • buttons (iOS Only) (enum):Specifies if "Cancel" and/or "Done" buttons should be forced to be displayed with the date picker dialog. The default behavior is device dependent, exhibiting the most native operation.
  • "done": display the Done button on the Date Picker
  • "cancelDone": display the Cancel and Done buttons on the Date Picker
  • "cancel": display the Cancel button on the Date Picker
  • The result:The selected date, time or date and time are returned in the result. The value is in seconds since the UNIX Epoch. If the picker is cancelled then cancel is returned in the result.
Advertisement