menu菜单选中状态设置
By
admin
at 2018-03-06 • 0人收藏 • 1384人看过
mainForm.XZpopmenu = win.ui.popmenu(mainForm);//创建弹出菜单 mainForm.XZpopmenu.add('850',function(id){ //在下面输入菜单响应代码 mainForm.XZpopmenu.check(1,!mainForm.XZpopmenu.checked(1)) }); mainForm.XZpopmenu.add('1270',function(id){ mainForm.XZpopmenu.check(2,!mainForm.XZpopmenu.checked(2)) }); mainForm.XZpopmenu.add('1310',function(id){ mainForm.XZpopmenu.check(3,!mainForm.XZpopmenu.checked(3)) }); mainForm.XZpopmenu.add('1330',function(id){ mainForm.XZpopmenu.check(4,!mainForm.XZpopmenu.checked(4)) }); mainForm.XZpopmenu.add('1490',function(id){ mainForm.XZpopmenu.check(5,!mainForm.XZpopmenu.checked(5)) }); mainForm.XZpopmenu.add('1550',function(id){ mainForm.XZpopmenu.check(6,!mainForm.XZpopmenu.checked(6)) }); var menu = win.ui.menu(mainForm);//创建主菜单 menu.add('波长选择',mainForm.XZpopmenu)
2 个回复 | 最后更新于 2018-03-07
import win.ui; /*DSG{{*/ var winform = win.form(text="单选菜单演示";right=565;bottom=443) winform.add() /*}}*/ import win.ui.menu; var menuRadio = win.ui.popmenu(winform); menuRadio.onMenuItemClick = function(id){ menuRadio.selId = id; select(menuRadio.selText) { case "墨绿色" { winform.bgcolor = 0x808000; winform.redraw() } case "深红色" { winform.bgcolor = 0x000080; winform.redraw() } case "淡蓝色" { winform.bgcolor = 0xcaf0a6; winform.redraw() } case "浅棕色" { winform.bgcolor = 0x800000; winform.redraw() } else { } } //winform.msgbox( menuRadio.selText ) } menuRadio.add("墨绿色" ) menuRadio.add("深红色" ) menuRadio.add("淡蓝色" ) menuRadio.add("浅棕色" ) var menu = win.ui.menu(winform); menu.add('设置窗口背景色',menuRadio) winform.show() win.loopMessage();
登录后方可回帖
一鹤先生新增的menu菜单单选功能: