本帖最后由 rmajly 于 2024-2-25 18:58 编辑
父窗体想把子窗体显示或隐藏起来很容易,但是反过来可能稍复杂些。注意子窗体放到工程的res文件夹下,另外工程的资源文件的属性中内嵌资源选true
父窗体代码:
[AAuto] 纯文本查看 复制代码 import win.ui;
/*DSG{{*/
var winform = win.form(parent=...; right=349;text="winform.parent";bottom=249 )
winform.add(
btnShowChild={ bottom=191;text="显示子窗口";left=167;top=164;z=1;right=289;cls="button" }
)
/*}}*/
winform.btnShowChild.oncommand = function(id,event){
var child,wb = winform.loadForm("\res\child.aardio",winform /*指定父窗口*/ );
child.btnHide.oncommand = function(id,event){
winform.show(false);
child.btnShow.disabled = false;
}
child.btnShow.oncommand = function(id,event){
winform.show(true);
child.btnShow.disabled = true;
}
child.doModal();
}
winform.show()
win.loopMessage();
return winform;
下面是子窗体代码:
[AAuto] 纯文本查看 复制代码 import win.ui;
/*DSG{{*/
var winform = win.form(parent=...; exmode="none";min=false;bottom=112;max=false;right=162;border="thin";text="winform.child" )
winform.add(
btnShow={ disabled=1;bottom=41;right=131;left=36;top=20;z=1;text="显示父窗口";cls="button" };
btnHide={ bottom=80;text="隐藏父窗口";left=37;top=59;z=2;right=132;cls="button" }
)
/*}}*/
winform.show()
win.loopMessage();
return winform;
|