diff --git a/inquirer.js b/inquirer.js index cce7014..b6bcdfa 100644 --- a/inquirer.js +++ b/inquirer.js @@ -14,14 +14,30 @@ if (!inqapp) inqapp = merger.app("inquirer", { title: "inquirer", + icon: icon, + windows: [merger.ui.window("Wmain", { + title: "Error", + width: 400, + height: 250, + content: [merger.ui.label("Lerror", { + top: 10, + left: 10, + text: "---" + })], + onClose: function () { + merger.leave(); + } + })], + mainWindow: "Wmain", + onLoad: function () { + } }); return inqapp; } function show() { - getApp().show(); - jsTK.desktop(); + getApp().focus(); var w = jsTK.get("Werror"); if (!w) { w = jsTK.window("Werror", { diff --git a/merger/core.js b/merger/core.js index d61d93b..af68939 100644 --- a/merger/core.js +++ b/merger/core.js @@ -158,6 +158,7 @@ c.append = function (control) { this.appendChild(control); this.controls[control.getId()] = control; + control.parent = this; } c.setContent = function (ctt) { for (var i = 0; i < ctt.length; i++) @@ -315,15 +316,14 @@ function app(id, def) { if (ui.app[id]) throw new Error("Application '" + id + "' already exists"); - var a = {} + var a = {}, windows = def.windows, i; ui.app[id] = a; a.merge({ getId: function () { return id; }, title: id, - mainWindow: undefined, - window: {}, + windows: {}, menu: undefined, onLoad: function () { @@ -342,9 +342,16 @@ this.onEnter(); } }); + delete (def.windows); a.merge(def); + if (windows) + for (i = 0; i < windows.length; i++) { + var win = windows[i]; + a.windows[win.getId()] = win; + win.parent = a; + } if (a.mainWindow) - a.window[a.mainWindow.getId()] = a.mainWindow; + a.mainWindow = a.windows[a.mainWindow]; if (a.onLoad) a.onLoad(); return a;