'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Base = Root
Dialog.Initialize (Base)
Dialog.BackgroundColor = Colors.White
'Colore della Barra del Titolo Calendiario
Dialog.TitleBarColor = xui.Color_ARGB(255, 0,129,129)
'Colore del Pulsante Annulla
Dialog.ButtonsColor = xui.Color_ARGB(255, 0,129,129)
Dialog.ButtonsTextColor = Colors.White
Log(GetPreferredLanguage)
Dialog.Title = "Seleziona il Giorno"
DateTemplate.Initialize
DateTemplate.MinYear = 2016
DateTemplate.MaxYear = 2030
DateTemplate.DaysInMonthColor = Colors.Black
DateTemplate.DaysInWeekColor = Colors.Black
DateTemplate.SelectedColor = xui.Color_ARGB(255, 0,129,129)
DateTemplate.lblMonth.TextColor = Colors.Black
DateTemplate.lblYear.TextColor = Colors.Black
End Sub
Sub GetPreferredLanguage As String
Dim no As NativeObject
Return no.Initialize("NSLocale").RunMethod("preferredLanguages", Null).RunMethod("objectAtIndex:", Array(0)).AsString
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
'only CANCEL needed
Wait For (Dialog.ShowTemplate(DateTemplate, "", "", "ANNULLA")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Log(DateTemplate.Date)
End If
End Sub