progressbar.js

来自「axjx工具代码给大家交流」· JavaScript 代码 · 共 66 行

JS
66
字号

Class('App.linb_UI_ProgressBar', 'linb.Com',{
    Instance:{
        //base Class for linb.Com
        base:["linb.UI"], 
        //requried class for the App
        //"linb.Tips","linb.UI.Resizer","linb.UI.Border","linb.UI.Shadow"
        required:["linb.UI.ProgressBar", "linb.UI.Button"], 
        iniComponents:function(){
            // [[code created by jsLinb UI Builder
            var host=this, children=[], append=function(child){children.push(child.get(0))};
            
            append((new linb.UI.ProgressBar)
                .host(host,"progressbar1")
                .setLeft(50)
                .setTop(70)
                .setCaptionTpl('{value}% finished')
            );
            
            append((new linb.UI.ProgressBar)
                .host(host,"progressbar2")
                .setLeft(50)
                .setTop(110)
                .setHeight(31)
                .setShadow(true)
                .setValue(60)
            );
            
            append((new linb.UI.ProgressBar)
                .host(host,"progressbar3")
                .setLeft(50)
                .setTop(160)
                .setBorder(true)
                .setResizer(true)
                .setFillBG("red")
                .setValue(30)
            );
            
            append((new linb.UI.Button)
                .host(host,"button21")
                .setLeft(370)
                .setTop(70)
                .setCaption("start")
                .onClick("_button21_onclick")
            );
            
            return children;
            // ]]code created by jsLinb UI Builder
        }, 
        _button21_onclick:function (profile, e, src, value) {
            var ns=this;
            linb.Thread(null,[_.fun()],300,function(threadid){
                var pb=ns.progressbar1,
                    value=pb.getValue();
                value+=10;
                if(value>=100)
                    value=100;
                pb.setValue(value, true);
                if(value==100)
                    linb.Thread.abort(threadid);
            },function(){
                ns.progressbar1.setValue(0,true);
            },null,true).start();
        }
    }
});

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?