经常会用到窗口快捷键,还有热键的设置。下面例子说明窗口热键的用法
import win.ui;
/*DSG{{*/
var winform = win.form(text="窗口控件快捷键例子";right=759;bottom=469)
winform.add(
button={cls="button";text="按钮(&N)";left=270;top=190;right=437;bottom=249;z=1}
)
/*}}*/
winform.button.oncommand = function(id,event){
win.msgbox("我被调用了")
}
/*
//使用超级热键也可以
import key.hotkey
$key = key.hotkey(winform)
$key.reg(
"ALT","N",
winform.button.oncommand
)
*/
//使用窗口快捷键
import win.ui.accelerator
win.ui.accelerator({
{ alt = true; vkey = 'N'#; oncommand = winform.button.oncommand }
},winform);
winform.show();
win.loopMessage();