B4X Store

ELEVATEUI · B4A · XUI

UIDateTimeDialog

Collect a date and time together for appointments or scheduled jobs.

78 modules 1,780 APIs

Dialogs & notifications

What it solves

Collect a date and time together for appointments or scheduled jobs.

Animated conceptual demonstration, not an exact Android control screenshot.

17 methods0 Designer3 events

When to use this module

When an operation needs confirmation or a result, process its response in the callback before updating the interface.

Before integrating, examine its methods, events and Designer options.

B4A integration examples

Tutorials are based on existing project examples or audited APIs. Check each example’s prerequisites; B4A compilation is not claimed.

Calendar: date or date range
Existing documentation example dialogs-registry.json Not B4A-compiled

Review required libraries, Designer views and input data before compiling in B4A.

' Ejemplo 5: modo calendario. Pega estos procedimientos en Main.
Private Sub btnDate_Click
    Dim dlg As UIDateTimeDialog
    dlg.Initialize(Activity, Me, "CalendarDate")
    dlg.SetMode(dlg.MODE_DATE)
    dlg.SetRangeSelectionMode(True)
    dlg.SetAutoCalendarBackground(True)
    dlg.SetAccentColor(0xFF259849)
    dlg.SetTitle("Choose a date")
    dlg.SetButtonTexts("Select", "Cancel")
    dlg.SetInitialDate(DateTime.Now)
    dlg.Show
End Sub

Private Sub CalendarDate_SubmitRange(StartDateMillis As Long, EndDateMillis As Long)
    Log("Inicio: " & DateTime.Date(StartDateMillis))
    Log("Fin: " & DateTime.Date(EndDateMillis))
End Sub

Private Sub CalendarDate_Submit(DateMillis As Long, TimeText As String)
    Log("Fecha: " & DateTime.Date(DateMillis))
End Sub

Private Sub CalendarDate_Cancel
    Log("Selección cancelada")
End Sub
Time picker
Existing documentation example dialogs-registry.json Not B4A-compiled

Review required libraries, Designer views and input data before compiling in B4A.

' Ejemplo 6: modo hora. Pega estos procedimientos en Main.
Private Sub btnTime_Click
    Dim dlg As UIDateTimeDialog
    dlg.Initialize(Activity, Me, "ClockTime")
    dlg.SetMode(dlg.MODE_TIME)
    dlg.SetTitle("Choose a time")
    dlg.SetButtonTexts("Select", "Cancel")
    dlg.SetInitialTime(9, 30, 0, "AM")
    dlg.Set24HourMode(False)
    dlg.SetShowSeconds(False)
    dlg.Show
End Sub

Private Sub ClockTime_Submit(DateMillis As Long, TimeText As String)
    Log("Hora seleccionada: " & TimeText)
End Sub

Private Sub ClockTime_Cancel
    Log("Selección de hora cancelada")
End Sub
Date and time picker
Existing documentation example dialogs-registry.json Not B4A-compiled

Review required libraries, Designer views and input data before compiling in B4A.

' Ejemplo 7: fecha y hora. Pega estos procedimientos en Main.
Private Sub btnDateTime_Click
    Dim dlg As UIDateTimeDialog
    dlg.Initialize(Activity, Me, "CalendarAndTime")
    dlg.SetMode(dlg.MODE_DATE_TIME)
    dlg.SetTitle("Choose date and time")
    dlg.SetButtonTexts("Select", "Cancel")
    dlg.SetInitialDate(DateTime.Now)
    dlg.SetInitialTime(9, 30, 0, "AM")
    dlg.Set24HourMode(False)
    dlg.SetShowSeconds(False)
    dlg.Show
End Sub

Private Sub CalendarAndTime_Submit(DateMillis As Long, TimeText As String)
    Log(DateTime.Date(DateMillis) & " at " & TimeText)
End Sub

Private Sub CalendarAndTime_Cancel
    Log("Fecha y hora canceladas")
End Sub

Public methods reference

17 audited signatures

Public Sub Initialize(Parent As B4XView, Callback As Object, EventName As String)

Prepare the instance before its other methods.

Original catalog note: Initialize the dialog with the host view and callback.

Parent As B4XViewCallback As ObjectEventName As String
Public Sub SetMode(Mode As Int)

Use SetMode for its named operation; follow its exact signature.

Original catalog note: Select date, time, or both before calling Show.

Mode As Int
Public Sub SetTitle(Title As String)

Use SetTitle for its named operation; follow its exact signature.

Title As String
Public Sub SetButtonTexts(SubmitText As String, CancelText As String)

Use SetButtonTexts for its named operation; follow its exact signature.

SubmitText As StringCancelText As String
Public Sub SetAccentColor(Color As Int)

Use SetAccentColor for its named operation; follow its exact signature.

Color As Int
Public Sub SetCalendarBackgroundColor(Color As Int)

Use SetCalendarBackgroundColor for its named operation; follow its exact signature.

Original catalog note: Sets the calendar surface color. SetAutoCalendarBackground(True) restores contrast-based coloring.

Color As Int
Public Sub SetAutoCalendarBackground(Enabled As Boolean)

Use SetAutoCalendarBackground for its named operation; follow its exact signature.

Original catalog note: Chooses a light or dark calendar surface based on the accent color.

Enabled As Boolean
Public Sub SetRangeSelectionMode(Enabled As Boolean)

Use SetRangeSelectionMode for its named operation; follow its exact signature.

Original catalog note: Enables start/end date selection. This is applied only in MODE_DATE, without a time picker.

Enabled As Boolean
Public Sub SetInitialDate(DateMillis As Long)

Use SetInitialDate for its named operation; follow its exact signature.

DateMillis As Long
Public Sub SetInitialTime(Hours As Int, Minutes As Int, Seconds As Int, Period As String)

Use SetInitialTime for its named operation; follow its exact signature.

Hours As IntMinutes As IntSeconds As IntPeriod As String
Public Sub Set24HourMode(Enabled As Boolean)

Use Set24HourMode for its named operation; follow its exact signature.

Enabled As Boolean
Public Sub SetShowSeconds(Enabled As Boolean)

Use SetShowSeconds for its named operation; follow its exact signature.

Enabled As Boolean
Public Sub SetDialogBackgroundColor(Color As Int)

Use SetDialogBackgroundColor for its named operation; follow its exact signature.

Original catalog note: Sets the background color of the complete dialog surface or selection panel. Supply an ARGB color (e.g., 0xFF202536).

Color As Int
Public Sub SetDialogBorderColor(Color As Int)

Use SetDialogBorderColor for its named operation; follow its exact signature.

Original catalog note: Sets the border color for the complete dialog surface. Supply an ARGB color.

Color As Int
Public Sub SetDialogBorderWidth(Width As Float)

Use SetDialogBorderWidth for its named operation; follow its exact signature.

Original catalog note: Sets the border stroke width for the complete dialog surface; zero hides the border.

Width As Float
Public Sub Show

Use Show for its named operation; follow its exact signature.

Original catalog note: Build a fixed dialog body with no scrolling.

Public Sub Close

Use Close for its named operation; follow its exact signature.

Designer · 0

No custom Designer properties were found in the audited API.

Public events and how to implement them · 3

Initialize with Me and the event prefix Demo, then add the following handler to your B4A module. Names and arguments come from the library declaration.

Submit(DateMillis As Long, TimeText As String)

Receives the user confirmation; validate parameters before saving.

B4A handler signature with Demo prefix

Private Sub Demo_Submit(DateMillis As Long, TimeText As String)
    Log("Submit")
End Sub
SubmitRange(StartDateMillis As Long, EndDateMillis As Long)

Receives the user confirmation; validate parameters before saving.

B4A handler signature with Demo prefix

Private Sub Demo_SubmitRange(StartDateMillis As Long, EndDateMillis As Long)
    Log("SubmitRange")
End Sub
Cancel

Event declared by this module. Handle the indicated action in the callback.

B4A handler signature with Demo prefix

Private Sub Demo_Cancel()
    Log("Cancel")
End Sub

For code-created controls use Initialize(Me, "Demo") when that signature exists; for Designer controls set the event name there. Replace Demo with the actual prefix.

Public fields, constants and types

Public Const MODE_DATE As Int = 1Public Const MODE_TIME As Int = 2Public Const MODE_DATE_TIME As Int = 3
Source: ElevateUI public API catalog; tutorials cross-checked against ElevateUI(6).b4xlib. Visualizations are illustrative; sample code requires B4A compilation.