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.
ELEVATEUI · B4A · XUI
Collect a date and time together for appointments or scheduled jobs.
Dialogs & notifications
Collect a date and time together for appointments or scheduled jobs.
Animated conceptual demonstration, not an exact Android control screenshot.
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.
Tutorials are based on existing project examples or audited APIs. Check each example’s prerequisites; B4A compilation is not claimed.
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
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
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
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.
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.
Public Sub SetTitle(Title As String)
Use SetTitle for its named operation; follow its exact signature.
Public Sub SetButtonTexts(SubmitText As String, CancelText As String)
Use SetButtonTexts for its named operation; follow its exact signature.
Public Sub SetAccentColor(Color As Int)
Use SetAccentColor for its named operation; follow its exact signature.
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.
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.
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.
Public Sub SetInitialDate(DateMillis As Long)
Use SetInitialDate for its named operation; follow its exact signature.
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.
Public Sub Set24HourMode(Enabled As Boolean)
Use Set24HourMode for its named operation; follow its exact signature.
Public Sub SetShowSeconds(Enabled As Boolean)
Use SetShowSeconds for its named operation; follow its exact signature.
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).
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.
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.
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.
No custom Designer properties were found in the audited API.
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.
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
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
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 Const MODE_DATE As Int = 1Public Const MODE_TIME As Int = 2Public Const MODE_DATE_TIME As Int = 3