Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private PrefDialog1 As PreferencesDialog
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim jo As JavaObject
jo.InitializeStatic("java.util.Locale").RunMethod("setDefault", Array(jo.GetField("CHINESE")))
CreateDialog1
End Sub
Private Sub B4XPage_Resize(Width As Int, Height As Int)
If PrefDialog1.IsInitialized And PrefDialog1.Dialog.Visible Then PrefDialog1.Dialog.Resize(Width, Height)
End Sub
Private Sub CreateDialog1
PrefDialog1.Initialize(Root, "Dialog", 300dip, 70dip)
PrefDialog1.Dialog.OverlayColor = xui.Color_ARGB(128, 0, 10, 40)
PrefDialog1.AddDateItem("Value", "Birthday")
PrefDialog1.DateTemplate.DaysOfWeekNames = Array As String("周日", "周一", "周二", "周三", "周四", "周五", "周六")
End Sub
Private Sub ShowDialog1 (Item As Map)
Dim sf As Object = PrefDialog1.ShowDialog(Item, "OK", "CANCEL")
Wait For (sf) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Log(Item)
End If
End Sub
Private Sub Button1_Click
ShowDialog1(CreateMap())
End Sub