右键菜单一案例QQ群分享

admin2021-03-01  2.8K+

import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add()
/*}}*/
import win.ui.menu
var menu = win.ui.popmenu(winform)
menu.addTable( {
 { "启动";  function(id){
  var s = menu.getString(1)=="启动" ? "停止" : "启动"
  menu.setString(1, s)
 } }; { /*分隔线*/ }
 { "退出程序"; function(id){  
  winform.close() 
 } };
} )
winform.wndproc = function(hwnd,message,wParam,lParam){
 select( message ) { 
  case 0x205/*_WM_RBUTTONUP*/{
   //鼠标右键弹起,下面获取坐标
                        var x,y = win.getMessagePos(lParam);
   menu.popup(x,y)
  }
 }
}
winform.show();
win.loopMessage();
转载请注明原文地址: https://aardio.net/read-158.html
最新回复(0)
aardio问答
aardio编程语言