Skip to content

Hybrid speedDial #152

@Al4He6

Description

@Al4He6

DS 2.79, ui 0.33
setName and setNameByIndex don't seem to do anything

Ditto for tooltipArrow and toolTipPosition
(not sure what these are supposed to do,
or what the correct camel case is - tip or Tip)


var main, rdg, rdg2, ckb, tgt, btn2, lay2, lay1
var items = [
            ["Copy", "file_copy"],
            ["Save", "save"],
            ["Print", "print"],
            ["Share", "share"]
            ]

export class Main extends App {
   onStart() {
         main = ui.addLayout("main", "Linear", "left,Top")
         var list = "Primary,Secondary,Default"
         rdg = ui.addRadioGroup(main, list,"outlined,primary,small,horizontal", 0.95)
         list = "Left,Right,Up,Bottom"
         rdg2 = ui.addRadioGroup(main, list,"outlined,primary,small,horizontal", 0.95)
         ckb = ui.addCheckboxGroup(main,"Fixed,Backdrop","outlined,horizontal,small")
         btn2 = ui.addButton(main, "Create SpeedDial","small,secondary")
         btn2.setOnTouch(function() {
            if(typeof tgt != "undefined") tgt.destroy()
            var opt = ""
            if (rdg.value != null && rdg.value > -1) opt = rdg.list[rdg.value]
            if (rdg2.value != null  && rdg2.value > -1) opt+=","+rdg2.list[rdg2.value]
            if(ckb.getCheckedByIndex(0)) opt += "," + ckb.getTextByIndex(0)
            if(ckb.getCheckedByIndex(1)) opt += "," + ckb.getTextByIndex(1)
            tgt = ui.addSpeedDial(lay1, items, opt)
            tgt.setOnAction( onAction )
            tgt.setOnOpen( onOpen )
            tgt.setOnClose( onClose )
            lay2.show()
          }) // ontouch
            lay1 = ui.addLayout(main,"Linear","top,left")
            lay2 = ui.addLayout(main,"Linear","top,left,scrolly",1,0.7)
            lay2.hide()
         bt('alert(tgt.el.innerHTML) ')
         bt('tgt.color="secondary" ')
         bt('tgt.backColor="green" ')
         bt('tgt.iconColor="yellow" ')
         bt('tgt.actionColor="blue" ')
         bt('tgt.actionSize="2rem" ')
         bt('tgt.iconSize="2rem" ')
         bt('tgt.icon = "more" ')
         bt('tgt.openIcon = "filter_5" ')
         bt('tgt.badge = 5')
         bt('tgt.setBadge("New", "Primary") ')
         bt('tgt.list = items')
         bt('tgt.addItem("a","filter_3", 1) ')
         bt('tgt.removeItem("Share") ')
         bt('tgt.removeItemByIndex(1) ')
         bt('tgt.setName("Share","filter_4") // ')
         bt('tgt.setNameByIndex(1,"filter_5") // ')
         bt('alert(tgt.popItem()) ')
         bt('alert(tgt.shiftItem()) ')
         bt('tgt.icon="more" ')
         bt('tgt.setEnabled("Save",!tgt.getEnabled("Save")) ')
         bt('tgt.setEnabledByIndex(0,!tgt.getEnabledByIndex(0)) ')
         bt('tgt.setIcon("Copy","filter_9") ')
         bt('tgt.setIconByIndex(2,"filter_8") ')
         bt('tgt.setIconColor("Copy","cyan") ')
         bt('tgt.setIconColorByIndex(2,"green") ')
         bt('tgt.setActionColorByIndex(2,"green") ')
         bt('tgt.setActionColor("Copy","cyan") ')
         bt('tgt.setActionSizeByIndex(2,"2rem") ')
         bt('tgt.setActionSize("Copy","2rem") ')
         bt('tgt.setIconSizeByIndex(2,"2rem") ')
         bt('tgt.setIconSize("Copy","2rem") ')
         bt('tgt.backdrop = !tgt.backdrop  ')
         bt('tgt.tooltipArrow = !tgt.tooltipArrow // ')
         bt('tgt.toolTipPosition = "bottom" // ')
         bt('tgt.hide() ')
         bt('tgt.show() ')
        
      } //onStart
} // class
function bt(txt) {
     var temp = ui.addText(lay2, txt, "keepcase",1)
     temp.backColor = "cyan"
     temp.setMargins(10, 5, 0, 0, "px")
     temp.setOnTouch(doit)
} // tgt
function doit() {
     eval(this.text)
    this.backColor = (this.backColor == "cyan") ? "red" : "cyan"
} // doit
function onAction(name, icon, index) {
        ui.showPopup( name )
    }
function onOpen() {
        ui.showPopup("Open", "Bottom")
    }
function onClose() {
        ui.showPopup("Close", "Bottom")
    }

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