有很多人曾经问过关于如何在内部dahsboard调出一个打开面板、保存面板或者打印面板。这是完全有可能的,不过有一些东西需要考虑一下。首先,这三种面板都是低于dashboard的视窗级的,这表示他们默认是不能在dashboard层以上显示的。作为一个例子,我们有这样一个保存面板:
nssavepanel *sp; int runresult; // holds the returned result button id // pointer to a shared instance of the save panel sp = [nssavepanel savepanel]; // show the window runresult = [sp runmodalfordirectory:nshomedirectory() file:@""]; |
如果这些代码在dashboard插件内部被调用,它会在dashboard背景层的下面显示。当然,面板的层级也是可以通过下面的代码来改变的:
[sp setlevel:nsscreensaverwindowlevel]; |