aardio 多个radiobutton状态判断

admin2020-12-03  1.3K+

if(winform.radiobutton.checked){
	status=0;
}
if(winform.radiobutton2.checked){
	status=1;
}
if(winform.radiobutton3.checked){
	status=2;
}
if(winform.radiobutton4.checked){
	status=3;
}
if(winform.radiobutton5.checked){
	status=4;
}

简化如下

 

方法一

	for(i=1;5;1){
		if(mainForm['radiobutton'+i].checked){
			win.msgbox(tostring(i) )
		}
	}

方法二

winform.button.oncommand=function(id,event){
	for(name,ctrl in winform.eachControl("radiobutton")){
		if(ctrl.checked){
			status=string.match(name,"\d");
			console.Log(status)
		}
	}
}
转载请注明原文地址: http://aardio.net/read-8.html
最新回复(0)
aardio问答
aardio编程语言