Private Sub Button1_Click
Dim PrefDialog2 As PreferencesDialog
PrefDialog2.Initialize(Root, "BB Administrator", 350dip, 250dip)
PrefDialog2.LoadFromJson( File.ReadString( File.DirAssets, "organizer.json"))
Private Options1 As Map
Dim List1 As List
List1.Initialize
Options1.Initialize
List1.Add("option 1")
List1.Add("long option 2")
List1.Add("very long option 3")
PrefDialog2.SetOptions("Event",List1)
Dim dia As Object = PrefDialog2.ShowDialog(Options1, "OK", "CANCEL")
SetWidthItem(PrefDialog2,"Event",250dip)
Wait For( dia) Complete( Result As Int)
If Result = xui.DialogResponse_Positive Then
' PrintOptions(Options1, TextArea1)
End If
End Sub
Private Sub SetWidthItem (Pref As PreferencesDialog, Key As String, wwidth As Double)
For i = 0 To Pref.PrefItems.Size - 1
Dim pi As B4XPrefItem = Pref.PrefItems.Get(i)
If pi.key = Key Then
If pi.ItemType = Pref.TYPE_SHORTOPTIONS Then
Dim Parent As B4XView = Pref.CustomListView1.GetPanel(i).GetView(1)
Parent.Left = (Parent.Left + Parent.Width) - wwidth
Parent.Width = wwidth
Dim view As B4XView = Parent.GetView( 0)
view.Width = Parent.Width
Else
Dim oldx As Double=Pref.CustomListView1.GetPanel(i).GetView(1).Left
Dim oldw As Double=Pref.CustomListView1.GetPanel(i).GetView(1).Width
Pref.CustomListView1.GetPanel(i).GetView(1).Left=(oldx+oldw)-wwidth
Pref.CustomListView1.GetPanel(i).GetView(1).Width= wwidth
End If
End If
Next
End Sub