tray 显示正常,逻辑待调整。
This commit is contained in:
parent
a725c59c5e
commit
153432e048
BIN
aardiowin/logo.ico
Normal file
BIN
aardiowin/logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@ -1,6 +1,6 @@
|
||||
import win.ui;
|
||||
import init;
|
||||
import win.util.tray;
|
||||
|
||||
|
||||
// 初始化
|
||||
init.init();
|
||||
@ -16,7 +16,6 @@ mainForm = win.form(text="awin";right=1;bottom=1;border="thin";max=false;min=fal
|
||||
mainForm.add()
|
||||
/*}}*/
|
||||
|
||||
|
||||
// 日志
|
||||
var gLog = init.getLog();
|
||||
gLog.print("width=" , gConfig.window.width)
|
||||
@ -26,25 +25,16 @@ gLog.print("height=" , gConfig.window.height)
|
||||
mainForm.resize(gConfig.window.width, gConfig.window.height);
|
||||
|
||||
// 托盘
|
||||
//var trayIcon = win.util.tray(mainForm, gConfig.icon, "双击打开主界面");
|
||||
//trayIcon.orphanWindow(true);
|
||||
//trayIcon.show();
|
||||
var icon = {
|
||||
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xf8\31\xff\xff\xe7\xe7\xff\xff\xdf\xfb\xff\xff\xbf\xfd\xff\xff\xbe}\xff\xff}\xbe\xff\xff\x7f\xfe\xff\xff\x7f\xfe\xff\xff\x7f\xfe\xff\xffs\xce\xff\xffs\xce\xff\xff\xbf\xfd\xff\xff\xbf\xfd\xff\xff\xdf\xfb\xff\xff\xe7\xe7\xff\xff\xf8\31\xff\xff';
|
||||
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\x81\xff\xff\x7e\x7e\xff\xff\xbd\xff\xff\xff\xdb\xff\xff\xff\xdb\xe7\xff\xff\xe7\xdb\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7<\xff\xff\xe7<\xff\xff\xdb\xff\xff\xff\xdb\xff\xff\xff\xbd\xff\xff\xff\x7e\x7e\xff\xff\xff\x81\xff\xff';
|
||||
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\31\xf8\xff\xff\xe7\xe7\xff\xff\xfb\xdf\xff\xff\xfd\xbf\xff\xff}\xbe\xff\xff\xbe}\xff\xff\xfe\x7f\xff\xff\xfe\x7f\xff\xff\xfe\x7f\xff\xff\xces\xff\xff\xces\xff\xff\xfd\xbf\xff\xff\xfd\xbf\xff\xff\xfb\xdf\xff\xff\xe7\xe7\xff\xff\31\xf8\xff\xff';
|
||||
'\0\0\1\0\1\0\16\16\2\0\1\0\1\0\xb0\0\0\0\22\0\0\0\40\0\0\0\16\0\0\0 \0\0\0\1\0\1\0\0\0\0\0\x80\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81\xff\xff\xff\x7e\x7e\xff\xff\xff\xbd\xff\xff\xff\xdb\xff\xff\xe7\xdb\xff\xff\xdb\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff<\xe7\xff\xff<\xe7\xff\xff\xff\xdb\xff\xff\xff\xdb\xff\xff\xff\xbd\xff\xff\x7e\x7e\xff\xff\x81\xff\xff\xff';
|
||||
}
|
||||
var currectIcon = 1;
|
||||
var tray = win.util.tray(mainForm, icon[currectIcon], mainForm.text);
|
||||
import win.util.tray;
|
||||
var tray = win.util.tray(mainForm,"./logo.ico") //创建托盘图标,如果不能显示图标,可能是图标问题,要复合图标
|
||||
tray.message = 0x400+9981/*_WM_TRAYMESSAGE*/
|
||||
tray.tip = gConfig.app //设置鼠标提示
|
||||
|
||||
var tmId = mainForm.setInterval(
|
||||
120,
|
||||
function(id) {
|
||||
currectIcon = currectIcon == 4 ? 1 : currectIcon + 1;
|
||||
tray.icon = icon[currectIcon];
|
||||
}
|
||||
);
|
||||
/*
|
||||
mainForm.onClose = function(hwnd,message,wParam,lParam){
|
||||
tray.delete(); //关闭窗口同时删掉托盘,避免关闭窗口后要鼠标移到托盘图标才消失
|
||||
}
|
||||
*/
|
||||
|
||||
//下面是添加托盘右键菜单
|
||||
import win.ui.menu;
|
||||
@ -61,7 +51,7 @@ import mouse;
|
||||
mainForm.wndproc = function(hwnd,message,wparam,lparam){
|
||||
select(message) {//判断消息类型
|
||||
case( 0x400+9981/*_WM_TRAYMESSAGE*/ ) { //托盘图标消息
|
||||
|
||||
|
||||
if(lparam = 0x203/*_WM_LBUTTONDBLCLK)*/){ //鼠标双击
|
||||
mainForm.show(true);
|
||||
}
|
||||
@ -69,20 +59,17 @@ mainForm.wndproc = function(hwnd,message,wparam,lparam){
|
||||
x,y = mouse.getPos();
|
||||
win.setForeground(mainForm.hwnd)
|
||||
mainForm.popmenu.popup(x,y,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
case( 0x112/*_WM_SYSCOMMAND*/ ){ //系统命令消息
|
||||
if( wparam == 0xF020/*_SC_MINIMIZE*/ ){ //用户点击了最小化按钮
|
||||
mainForm.show(false); //隐藏窗口
|
||||
return true;//阻击默认消息传递,取消最小化过程
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainForm.onClose = function(hwnd,message,wParam,lParam){
|
||||
tray.delete(); //关闭窗口同时删掉托盘,避免关闭窗口后要鼠标移到托盘图标才消失
|
||||
}
|
||||
// 前端
|
||||
import web.view;
|
||||
var theView = web.view(mainForm);
|
||||
@ -113,4 +100,4 @@ if( gDebug ){
|
||||
|
||||
mainForm.show();
|
||||
win.loopMessage();
|
||||
tray.delete();
|
||||
// tray.delete();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user