批量操作窗口控件(checkbox)示例

    批量操作窗口控件(checkbox)示例

    import win.ui;
    /*DSG{{*/
    var winform = ..win.form(text=””AAuto Form””;right=599;bottom=399)
    winform.add(
    button={cls=””button””;text=””全选””;left=206;top=324;right=270;bottom=358;z=15};
    checkbox={cls=””checkbox””;text=””checkbox””;left=418;top=163;right=501;bottom=189;z=1};
    checkbox10={cls=””checkbox””;text=””checkbox10″”;left=277;top=37;right=360;bottom=63;z=10};
    checkbox11={cls=””checkbox””;text=””checkbox11″”;left=152;top=84;right=235;bottom=110;z=11};
    checkbox12={cls=””checkbox””;text=””checkbox12″”;left=330;top=94;right=413;bottom=120;z=12};
    checkbox13={cls=””checkbox””;text=””checkbox13″”;left=154;top=115;right=237;bottom=141;z=13};
    checkbox14={cls=””checkbox””;text=””checkbox14″”;left=322;top=243;right=405;bottom=269;z=14};
    checkbox2={cls=””checkbox””;text=””checkbox2″”;left=56;top=38;right=139;bottom=64;z=2};
    checkbox3={cls=””checkbox””;text=””checkbox3″”;left=103;top=181;right=186;bottom=207;z=3};
    checkbox4={cls=””checkbox””;text=””checkbox4″”;left=55;top=76;right=138;bottom=102;z=4};
    checkbox5={cls=””checkbox””;text=””checkbox5″”;left=233;top=86;right=316;bottom=112;z=5};
    checkbox6={cls=””checkbox””;text=””checkbox6″”;left=57;top=107;right=140;bottom=133;z=6};
    checkbox7={cls=””checkbox””;text=””checkbox7″”;left=225;top=235;right=308;bottom=261;z=7};
    checkbox8={cls=””checkbox””;text=””checkbox8″”;left=143;top=36;right=226;bottom=62;z=8};
    checkbox9={cls=””checkbox””;text=””checkbox9″”;left=388;top=50;right=471;bottom=76;z=9}
    )
    /*}}*/

    winform.button.oncommand = function(id event){
    ” for (k” v in winform){
    ” if(v[[“”””cls””””]]==””””checkbox””””){”
    ” v.checked=true”
    ” }”
    ” }”
    }
    winform.show()
    win.loopMessage();
    下面这个是第二种方法 来自@超级糖葫芦 import win.ui;
    /*DSG{{*/
    var winform = ..win.form(text=””AAuto Form””;right=599;bottom=399)
    winform.add(
    button={cls=””button””;text=””全选””;left=206;top=324;right=270;bottom=358;z=15};
    checkbox={cls=””checkbox””;text=””checkbox””;left=418;top=163;right=501;bottom=189;z=1};
    checkbox10={cls=””checkbox””;text=””checkbox10″”;left=277;top=37;right=360;bottom=63;z=10};
    checkbox11={cls=””checkbox””;text=””checkbox11″”;left=152;top=84;right=235;bottom=110;z=11};
    checkbox12={cls=””checkbox””;text=””checkbox12″”;left=330;top=94;right=413;bottom=120;z=12};
    checkbox13={cls=””checkbox””;text=””checkbox13″”;left=154;top=115;right=237;bottom=141;z=13};
    checkbox14={cls=””checkbox””;text=””checkbox14″”;left=322;top=243;right=405;bottom=269;z=14};
    checkbox2={cls=””checkbox””;text=””checkbox2″”;left=56;top=38;right=139;bottom=64;z=2};
    checkbox3={cls=””checkbox””;text=””checkbox3″”;left=103;top=181;right=186;bottom=207;z=3};
    checkbox4={cls=””checkbox””;text=””checkbox4″”;left=55;top=76;right=138;bottom=102;z=4};
    checkbox5={cls=””checkbox””;text=””checkbox5″”;left=233;top=86;right=316;bottom=112;z=5};
    checkbox6={cls=””checkbox””;text=””checkbox6″”;left=57;top=107;right=140;bottom=133;z=6};
    checkbox7={cls=””checkbox””;text=””checkbox7″”;left=225;top=235;right=308;bottom=261;z=7};
    checkbox8={cls=””checkbox””;text=””checkbox8″”;left=143;top=36;right=226;bottom=62;z=8};
    checkbox9={cls=””checkbox””;text=””checkbox9″”;left=388;top=50;right=471;bottom=76;z=9}
    )
    /*}}*/

    winform.button.oncommand = function(id event){

    for(name ctrl in winform.eachControl(checkbox) ){
    ” ctrl.checked=true”
    }

    }
    winform.show()
    win.loopMessage();”

    转载请注明:Travis Data Experiment » 批量操作窗口控件(checkbox)示例

    喜欢 0
分类:编程收获

还没有人抢沙发呢~