B4XPreferencesDialog

Cadenzo

Active Member
Licensed User
Longtime User
Yes, great, I am also first time playing with it. What about clipboard import/export in FormsBuilder?

Change in layout file / MenuBar1 / MenuItems:
B4X:
{Text: "Save _As", EventName: "mnuSaveAs"},
            {Text: "Clipboard export", EventName: "mnuClipboardExport"},
            {Text: "Clipboard import", EventName: "mnuClipboardImport"}
And add in the code:
B4X:
Sub mnuClipboardExport_Action
    Dim sJson As String = ExportToString(True) 'True? False?
    fx.Clipboard.SetString(sJson)
    fx.Msgbox(MainForm, sJson, "JSON now in the Clipboard")
End Sub

Sub mnuClipboardImport_Action
    Dim sJson As String = fx.Clipboard.GetString
    Select 1 '0 '0 for import, 1 for just showing
        Case 0
            list.Clear
            AddItemsFromString(sJson)
        Case 1
            PrefDialog.Clear
            PrefDialog.LoadFromJson(sJson)
            PrefDialog.ShowDialog(CreateMap(), "Ok", "Cancel")
    End Select
End Sub

Than we can easily share preferences like this:
B4X:
{
    "Version": 1.66,
    "Theme": "Dark Theme",
    "Items": [
        {
            "title": "Important",
            "type": "Boolean",
            "key": "k1",
            "required": false
        },
        {
            "options": [
                "Wow",
                "Great",
                "Super",
                "I was waiting for it"
            ],
            "title": "What do you think?",
            "type": "Options",
            "key": "k2",
            "required": false
        },
        {
            "title": "When do you think?",
            "type": "Date",
            "key": "k3",
            "required": false
        },
        {
            "title": "your philosophy of life",
            "type": "Multiline Text",
            "key": "k4",
            "required": false
        },
        {
            "title": "your main philosophy ",
            "type": "Decimal Number",
            "key": "k5",
            "required": false
        }
    ]
}

Is that important? No :)
 
Top