Next week: cross platform preferences dialog

Erel

Administrator
Staff member
Licensed User
Easy to build and easy to work with:

Build:
B4X:
p.Initialize (MainForm.RootPane, "Preferences Example")
'first parameter is the item key.
p.AddSeparator("Category #1")
p.AddBooleanItem("1", "Yes or No?")
p.AddBooleanItem("2", "Yes or No?")
p.AddColorItem("Favorite Color", "Color")
p.AddSeparator("Category #2")
p.AddDateItem("Birthday", "Birthday")
p.AddSeparator("Category #3")
p.AddOptionsItem("opt1", "Options example", Array("Red", "Green", "CCC"))
p.AddTextItem("fsf", "Something")
p.AddTextItem("fsf23", "Something")
Show:
B4X:
Sub Button1_Click
   Dim d As Map = CreateMap("Birthday": DateTime.DateParse("01/03/2016"), _
       "Favorite Color": xui.Color_Green)
   Wait For (p.ShowDialog(d, "OK", "CANCEL")) Complete (Result As Int)
   If Result = xui.DialogResponse_Positive Then
       Dim xv As B4XView = MainForm.RootPane
       xv.Color = d.Get("Favorite Color")
   End If
End Sub
The data is stored in a map. You can use different maps to show and edit the values of different "objects".
It is also simple to store the data with B4XSerializator.

preferences.gif
 
Top