#Region Project Attributes
#MainFormWidth: 500
#MainFormHeight: 400
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Public PrefDialog As PreferencesDialog
Private Base As B4XView
Private xui As XUI
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
Base = MainForm.RootPane
CallSubDelayed(Me, "Button1_Click")
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub Button1_Click As ResumableSub
Log("#-Sub Button1_Click")
Dim DialogPanelWidth As Int = 400dip
Dim DialogPanelHeight As Int = 250dip
PrefDialog.Initialize(Base, "Single Dialog created via 'PreferencesDialog'", DialogPanelWidth, DialogPanelHeight)
PrefDialog.LoadFromJson(File.ReadString(File.DirAssets, "B4xPrefBuilderMultiline1.json"))
Dim datamap As Map = CreateMap("c6noteedit": $"
"People often say that motivation doesn't last. Well, neither does bathing -- that's why we recommend it daily." -Zig Ziglar
"Someday is not a day of the week." -Denise Brennan-Nelson
"Hire character. Train skill." -Peter Schutz
"$)
Dim sf As Object = PrefDialog.ShowDialog(datamap, "OK", "CANCEL")
For i = 0 To PrefDialog.PrefItems.Size - 1
Dim pi As B4XPrefItem = PrefDialog.PrefItems.Get(i)
Log($"#- x52, pi.Key=${pi.Key}, pi.ItemType=${pi.ItemType}, (PrefDialog.TYPE_MULTILINETEXT=${PrefDialog.TYPE_MULTILINETEXT}) "$)
If pi.ItemType = PrefDialog.TYPE_MULTILINETEXT Then
Dim ft As B4XFloatTextField = PrefDialog.CustomListView1.GetPanel(i).GetView(0).Tag
' Hide the action labels (x) and (✓) by position them out of sight
Log($"#- x54, before: ft.lblClear.Left=${ft.lblClear.Left}, , ft.lblV.Left=${ft.lblV.Left}"$)
ft.lblClear.Left = -100dip
ft.lblV.Left = -100dip
Log($"#- x58, after: ft.lblClear.Left=${ft.lblClear.Left}, , ft.lblV.Left=${ft.lblV.Left}"$)
End If
Next
Wait For (sf) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
Log("#- x41, item = " & datamap)
End If
Return Null
End Sub