Private Sub btnMapSettings_Click
lblSettingsType.Text = "Map"
LoadPreferencesDialog(0, 0, 17, False)
ProcessSettings
End Sub
Private Sub LoadPreferencesDialog(iMapIndex As Int, iStartIndex As Int, iEndIndex As Int, bSetOptions As Boolean)
iOptionsIndex = iMapIndex
prefdialog.Initialize(pnlSettings, "", pnlSettings.Width, pnlSettings.Height - 40dip)
prefdialog.bDisableSoftKeyboard = True 'newly added to the b4xlib
prefdialog.TextFieldFontSize = 17 * cMP.fTextRatio 'newly added to the b4xlib
prefdialog.TextFieldID = Enums.eEditText.PreferencesDialogTextField 'newly added to the b4xlib
prefdialog.LoadFromJson(File.ReadString(File.DirAssets, "PhonePats_Settings.json"), iStartIndex, iEndIndex)
If bSetOptions Then
prefdialog.ComboBoxWidth = iComboBoxWidth 'newly added to the b4xlib
prefdialog.ComboBoxLeft = iComboBoxLeft 'newly added to the b4xlib
prefdialog.SetOptions("Enums.iDateFormat", File.ReadList(File.DirAssets, "tabledatetypes.txt"))
End If
prefdialog.SetEventsListener(Me, "PrefDialog")
'to get the variable values to be changed
'----------------------------------------
LoadSavedData
End Sub
Private Sub LoadSavedData
Dim i As Int
Dim tItem As B4XPrefItem
For i = 0 To prefdialog.PrefItems.Size - 1
tItem = prefdialog.PrefItems.Get(i)
arrOptions(iOptionsIndex).Put(tItem.Key, GetVarValues(tItem.Key))
Next
End Sub
Sub ProcessSettings
Dim pd As Object = prefdialog.ShowDialog(arrOptions(iOptionsIndex), "OK", "CANCEL")
Wait For (pd) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
SaveOptions
End If
lblSettingsType.Text = ""
cMP.HideKeyboard
End Sub
Public Sub SaveOptions
Dim bSave As Boolean
'Log("SaveOptions")
For Each key As String In arrOptions(iOptionsIndex).Keys
If key = "" Then Continue 'separators
bSave = key <> "Enums.bAllowOnlyRealXLDates" And _
key <> "Enums.bCalculateRadius" And _
key <> "Enums.bShowChartLineDates" And _
key <> "Enums.bMickeyMouse"
SetVarValues(key, arrOptions(iOptionsIndex).Get(key), bSave)
'Log(arrOptions(iOptionsIndex).Get(key))
Next
If vSelectedTextField.IsInitialized Then
cMP.ClearFocus(vSelectedTextField)
End If
End Sub