Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private Dialog As B4XDialog
Private DateTemplate As B4XDateTemplate
Private xui As XUI
Private CustomDialogPanel As B4XView
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.LoadLayout("1")
NavControl.ShowPage(Page1)
DateTemplate.Initialize
Dialog.Initialize(Page1.RootPanel)
Dialog.Title = "B4i"
CustomDialogPanel = xui.CreatePanel("")
Dim btn As Button
btn.Initialize("btn", btn.STYLE_SYSTEM)
btn.Text = "Click to select date"
CustomDialogPanel.SetLayoutAnimated(0, 0, 0, 300dip, 300dip)
CustomDialogPanel.AddView(btn, 20dip, 20dip, 200dip, 100dip)
End Sub
Sub Page1_Click
ShowFirstDialog
End Sub
Sub ShowFirstDialog
Wait For (Dialog.ShowCustom(CustomDialogPanel, "OK", "", "")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Dim date As Long = CustomDialogPanel.Tag
Page1.Title = DateTime.Date(date)
End If
End Sub
Sub btn_Click
Dialog.Close(xui.DialogResponse_Cancel)
Do While Dialog.Visible
Sleep(30)
Loop
Wait For (Dialog.ShowTemplate(DateTemplate, "OK", "", "")) Complete (Result As Int)
CustomDialogPanel.Tag = DateTemplate.Date
CustomDialogPanel.GetView(0).Text = DateTime.Date(DateTemplate.Date)
ShowFirstDialog
End Sub