请教大师,我使用了godking.message做为窗体退出和虚表中弹出输入框时,为何执行不了 modalMode,点击主窗体时,对话框就退到后面了,
还有就是message窗体好像 chekbox无法实现透明显示。
请帮忙看看如下代码,谢谢
import fonts.fontAwesome;
import win.ui;
import godking.message
import godking.vlistEx;
import win.ui.atom;
/*DSG{{*/
mainForm = win.form(text="godking.message 对话框测试";right=651;bottom=368;bgcolor=16777215;border="none")
mainForm.add(
titleBar={cls="bkplus";left=0;top=0;right=652;bottom=41;bgcolor=7881760;dl=1;dr=1;dt=1;forecolor=16777215;linearGradient=180;z=1};
vlistEx={cls="vlistEx";left=6;top=46;right=652;bottom=364;acceptfiles=1;aw=1;dl=1;dr=1;dt=1;edge=1;z=2}
)
/*}}*/
var form = /***
/*DSG{{*/
var winform = win.form(text="离线定时";right=470;bottom=124;border="thin";exmode="none";max=false;min=false;mode="popup")
winform.add(
plus3={cls="plus";text="当前时段";left=300;top=30;right=393;bottom=59;align="left";dl=1;dt=1;iconColor=32768;iconStyle={align="left";font=LOGFONT(h=-19;name='FontAwesome')};iconText='\uF017';textPadding={left=30};transparent=1;z=3};
timepick1={cls="datetimepick";left=6;top=32;right=137;bottom=57;edge=1;transparent=1;updown=1;z=1};
timepick2={cls="datetimepick";left=158;top=32;right=289;bottom=57;edge=1;transparent=1;updown=1;z=2}
)
/*}}*/
//win.setTopmost(winform.hwnd,true) //窗体置前
win.showForeground(winform.hwnd)
winform.show();
//winform.editAC.setFocus();
win.loopMessage();
***/
var msg = godking.message()
msg.showOK = false
msg.showTitlebar =false;
msg.round = 12;
msg.borderWidth=2;
msg.borderColor = 0xFFFF0000;
msg.minWidth =500;
msg.btnBgColor =0xFFFF7F00
import win.ui.simpleWindow;
win.ui.simpleWindow( mainForm );
mainForm.vlistEx.setColumns({"名称", "开关"},{120,100} , 1);
mainForm.vlistEx.addImg("TMON","\tmON.png")
mainForm.vlistEx.addImg("TMOFF","\tmOFF.png")
mainForm.vlistEx.setRowHeight(40);
mainForm.vlistEx.setHeaderHeight(30)
mainForm.vlistEx.headerFont = ::LOGFONT(name="微软雅黑";point=11;color=0x000000); //设置表头默认字体
var t = {
{"通道1","<img name='TMOFF',w=66,h=40>"}
{"通道2","<img name='TMOFF',w=66,h=40>"}
{"通道3","<img name='TMOFF',w=66,h=40>"}
}
mainForm.vlistEx.setTable(t,false);
mainForm.enableDpiScaling("init"); // 加入这句
mainForm.vlistEx.headerBkcolor = 0xE0E0E0;
mainForm.vlistEx.onEditBegin = {true,1,2}; // 只允许第1列、第2列可编辑
mainForm.vlistEx.onClick = function(row/*行*/,col/*列*/,x,y){
//定时开关
if col== 2 {
var swONOFF = mainForm.vlistEx.getCellImg(row,col)=='TMON' ? "TMOFF" : "TMON"
mainForm.vlistEx.setCellImg(row,col,swONOFF)
msg.icon='\uF017'
//msg.modalMode=true
msg.showOK = false
msg.showTitlebar =false;
msg.round = 12;
msg.minWidth=500;
msg.borderWidth=2;
msg.btnBgColor =0xFF02CF88;
msg.borderColor = 0xFF02CF88;
var r = msg.form("离线定时设置",form,true,0,function(winform){
/*在信息框中加载子窗口,参数:1、信息文本;2、form子窗体代码;3、是否显示确认取消按钮;4、超时关闭时间;5、确定按钮事件函数;
该函数的参数为加载的子窗体对象,该函数的返回值作为 modalMode=true 时 form() 函数的返回值*/
return {winform.timepick1.text,winform.timepick2.text};
})
if (r) {
msg.info(r[1] ++ r[2],1000)
}
}
}
mainForm.wndproc = function(hwnd,message,wparam,lparam){
select(message) {//判断消息类型
case 0x10/*_WM_CLOSE窗口关闭消息*/{
//if(win.msgboxTest("请确认要退出当前程序?","提示")=false){
// if (!mainForm.msgAsk("请确认要退出当前程序?")) { return wparam; };
a=msg.ask("请确认要退出?")
if !a { return wparam; };
//}
}
}
//无返回值则继续调用默认回调函数
}
mainForm.show();
return win.loopMessage();