Skip to content

Hybrid Dialog #144

@Al4He6

Description

@Al4He6

V32 addDialog
Changing property titleColor seems to have no effect on display


var main, rdg, ckb, btn, tgt,lay2
export class Main extends App {
   onStart() {
         main = ui.addLayout("main", "Linear", "left,Top")
         rdg = ui.addRadioGroup(main, "Primary,Secondary","outlined,primary,small,horizontal", 1)
         ckb = ui.addCheckboxGroup(main,"NoCancel,KeepCase,fullscreen","outlined,horizontal,small",1)
         ckb.setChecked("NoCancel",true)
         btn = ui.addButton(main, "Create Dialog","small,secondary")
         btn.setOnTouch(function() {
            if(typeof tgt != "undefined") tgt.destroy()
            var opt = ""
            if (rdg.value!=null) opt = rdg.list[rdg.value]
            if(ckb.getCheckedByIndex(0)) opt += "," + ckb.getTextByIndex(0)
            if(ckb.getCheckedByIndex(1)) opt += "," + ckb.getTextByIndex(1)
            if(ckb.getCheckedByIndex(2)) opt += "," + ckb.getTextByIndex(2)
            tgt = ui.addDialog("Title","Body","Hide,Action2",opt)
            tgt.setOnAction(onAction)
            tgt.setOnOpen(function(){alert("Open") })
            tgt.setOnClose(function(){alert("Close") })
            tgt.show()
            lay2.show()
         }) // ontouch
         lay2 = ui.addLayout(main,"linear","left,top")
         bt('tgt.titleColor="blue" ')
         bt('tgt.textColor="magenta" ')
         bt('tgt.actionColor="green" ')
         bt('tgt.titleSize="2rem" ')
         bt('tgt.textSize="2rem" ')
         bt('tgt.actionSize="2rem" ')
         bt('tgt.titleWeight="Thin" ')
         bt('tgt.textWeight="Thin" ')
         bt('tgt.actionWeight="Thin" ')
         bt('tgt.title="New Title" ')
         bt('tgt.text="New Text" ')
         bt('tgt.setActionColor("Hide","red") ')
         bt('tgt.setActionColorByIndex(1,"green") ')
         bt('tgt.setActionSize("Hide","2rem") ')
         bt('tgt.setActionSizeByIndex(1,"2rem") ')
         bt('tgt.setActionWeight("Hide","Thin") ')
         bt('tgt.setActionWeightByIndex(1,"Thin") ')
         bt('tgt.setEnabledAction("Hide",false) ')
         bt('tgt.setEnabledActionByIndex(1,false) ')
         var list="flex-start,flex-end,center,space-between,space-evenly,space-around"
         var dpd=ui.addDropdown(lay2,list,"keepcase,small")
         dpd.setOnTouch(function(text,index,icon,pos) {
            tgt.justifyActions = text
         })
         dpd.backColor="cyan"
         bt('tgt.hide() ')
         bt('tgt.show() ')
         lay2.hide()
      } //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)
} // btn
function doit() {
     eval(this.text)
} // doit
function onAction(action,index) {
        if(action == "Hide") {
           tgt.hide()
        } else {
           alert(action+" "+index)
        } // if
} onAction

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