Skip to content

Hybrid Treeview #145

@Al4He6

Description

@Al4He6

V033 Treeview
iconColor doesn't seem to affect the screen
disabled doesn't disable the control nor affect screen
and ontouch still fires

var lay2,trv,trv2

class Main extends App {
    onStart() {
        this.main = ui.addLayout("main", "Linear", "top")
        lay2 = ui.addLayout(this.main,"Linear","top,scrolly",1,0.5)
        
        var items = {
            "Internal": {
                "DCIM": {
                    "Camera": "",
                    "Screenshots": "",
                    "Messenger": ""
                },
                "Download": {
                    "icon logo.png": "",
                    "Cloud.zip": "",
                    "droidscript_v2.76b3.apk": "",
                },
                "Documents": {
                    "Final Sheet.docx": "",
                    "icon logo.png": "",
                    "Cloud.zip": "",
                    "Digital.pdf": ""
                }
            },
            "Apps": {
                "droidscript_v2.76b3.apk": "",
                "droidscript_v2.76b2.apk": "",
                "droidscript_v2.76b1.apk": "",
                "Messenger.apk": ""
            },
            "Others": {
                "Drive": "",
                "Cloud": ""
            }
        }
        trv = ui.addTreeView(this.main, items, "", 0.7)
        trv.setMargins(0,0,0,20,"px")
    
        items = {
            "Internal": {
                "DCIM": {
                    "Camera": "camera",
                    "Screenshots": "screenshot",
                    "Messenger": "photo"
                },
                "Download": {
                    "icon logo.png": "file_png",
                    "Cloud.zip": "folder_zip",
                    "droidscript_v2.76b3.apk": "apk_install",
                },
                "Documents": {
                    "Final Sheet.docx": "docs",
                    "icon logo.png": "file_png",
                    "Cloud.zip": "folder_zip",
                    "Digital.pdf": "picture_as_pdf"
                }
            },
            "Apps": {
                "droidscript_v2.76b3.apk": "apk_install",
                "droidscript_v2.76b2.apk": "apk_install",
                "droidscript_v2.76b1.apk": "apk_install",
                "Messenger.apk": "apk_install"
            },
            "Others": {
                "Drive": "add_to_drive",
                "Cloud": "cloud"
            }
        }

        trv2 = ui.addTreeView(this.main, items, "", 0.7)
        trv2.setOnTouch( this.onTouch )
        trv2.setOnToggle( function(paths) {alert(JSON.stringify(paths))})
        
        bt('trv2.backColor="red"')
        bt('trv2.color = "#ff9900"')
        bt('trv2.iconColor="cyan" // ?')
        bt('trv2.textColor="yellow"')
        bt('trv2.selectedColor = "magenta"')
        bt('trv2.selectedTextColor = "green"')
        bt('trv2.textSize = "2rem"')
        bt('trv2.iconSize = "2rem"')
        bt('trv2.textWeight = "thin"')
        bt('trv2.selectedTextWeight = "bold"')
        bt('trv2.collapseIcon="remove"')
        bt('trv2.expandIcon="add"')
        bt('trv2.disabled=!trv2.disabled // ?')
        bt('alert(trv2.disabled)')

}

    onTouch(value, path) {
        ui.showPopup("Value: "+value + " Path: "+path)
    }
}
function bt(txt) {
      var temp = ui.addText(lay2, txt, "keepcase",1)
      temp.backColor = "cyan"
      temp.setMargins(10, 5, 0, 0, "px")
      temp.setOnTouch(doit)
} // bt
function doit() {
      eval(this.text)
} // doit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions