aardio批量生成按钮实例

 

import win.ui;
import console;
/*DSG{{*/
var winform = win.form(text="批量生成按钮实例";right=759;bottom=469)
winform.add(
custom={cls="custom";text="自定义控件";left=10;top=10;right=749;bottom=455;z=1}
)
/*}}*/

//aardio批量生成按钮实例

import win.ui.css;
var css =win.ui.css();
import godking.message;

//做3个按钮,第1个,右1,下1
//得到第一个按钮位置,左右上下间距
left,right,top,bottom = 58,178,36,88
toRight = 130
toBottom = 72
rows,cols = 5,5

buttonTab = {}; //批量生成位置
for(i=1;rows;1){ //行
	for(j=1;cols;1){ //列
		table.push(buttonTab,{
			left+(j-1)*toRight,right+(j-1)*toRight,
			top+(i-1)*toBottom,bottom+(i-1)*toBottom
		})
	}

}
//console.dump(buttonTab)

for(i=1;rows*cols;1){ //动态生成控件
	left,right,top,bottom = table.unpack(buttonTab[i]);
    //winform.add(
    winform.custom.addCtrl(
		['button'+i]={cls="plus";text="按钮"++i;
			left=left;top=top;right=right;
			bottom=bottom;z=1};
	)
	winform.custom["button"+i].border={radius=30}; //顺序
	winform.custom["button"+i].skin(css.primary); //css

    winform.custom['button'+i].oncommand = function(id,event){
		winform.msgOk(owner.text)
	}
}

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值