下面是quicker的代码去掉了图片,点击 确定 或 取消 按钮 ,lightBoxDialog对话框就消失了
import win.ui;
/*DSG{{*/
var winform = ..win.form( bottom=399;parent=...;right=599;text="HTMLayout 高亮对话框效果" )
winform.add( )
/*}}*/
import web.layout;
import web.layout.behavior.lightBoxDialog;
var wbLayout = web.layout(winform);
wbLayout.html = /*********
<html>
<head>
<style>
html{
font:system;
}
form.light-box-dialog {
behavior: light-box-dialog;
display:none;
width:50%;
height:50%;
margin:*;
background-color:red;
background-position:26 26 26 26;
padding:28px;
}
div.shim /* background shim, spans whole view */ {
position: fixed;
top:0;
right:0;
bottom:0;
left:0;
background-color: rgba(0,0,0,0.5);
}
button#test-dlg{
click!:$1(form.light-box-dialog).show();
}
</style>
</head>
<body>
<form.light-box-dialog>
<p .button-bar ><button role="ok-button">确定</button><button role="cancel-button">取消</button></p>
<p>这里随便放点文本什么的....<p>
</form>
<p>测试内容: <input type="text" value="HTMLayout 非常好用"/> <button>某些控件</button></p>
<button #test-dlg>点这里弹出对话框</button>
</body>
</html>
*********/
winform.show()
win.loopMessage();
我改成这样的 点击 确定 或 取消 按钮 ,就没反应了
import win.ui;
/*DSG{{*/
var winform = ..win.form( bottom=399;parent=...;right=599;text="HTMLayout 高亮对话框效果" )
winform.add( )
/*}}*/
import web.layout;
import web.layout.behavior.lightBoxDialog;
var wbLayout = web.layout(winform);
wbLayout.html = /*********
<html>
<head>
<style>
html{
font:system;
}
form.light-box-dialog {
behavior: light-box-dialog;
display:none;
width:50%;
height:50%;
margin:*;
background-color:red;
background-position:26 26 26 26;
padding:28px;
}
div.shim /* background shim, spans whole view */ {
position: fixed;
top:0;
right:0;
bottom:0;
left:0;
background-color: rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<form.light-box-dialog>
<p .button-bar ><button role="ok-button">确定</button><button role="cancel-button">取消</button></p>
<p>这里随便放点文本什么的....<p>
</form>
<p>测试内容: <input type="text" value="HTMLayout 非常好用"/> <button>某些控件</button></p>
<button #test-dlg>点这里弹出对话框</button>
</body>
</html>
*********/
//去掉了css里面的代码,换成下面的代码 可以显示出来,但确定和取消按钮点击就没反应了
submit=wbLayout.getEle("test-dlg")
submit.onButtonClick = function (ltTarget,ltEle,reason,behaviorParams) {
var ltbox=web.layout.behavior.lightBoxDialog( wbLayout.$1("form.light-box-dialog"),wbLayout)
ltbox.show(wbLayout.$1("form.light-box-dialog"))
return ;
}
submit.attachEventHandler()
winform.show()
win.loopMessage();
|