-
6 Jan 2011 6:40 AM #1
Calling multiple windows
Calling multiple windows
Hi
I'm looking for a way to construct windows with custom additionnal dom on load and possibilities to bind event (for a common toolbar)
I tried to achieve this by extending the Ext.air.NativeWindow class and performing changes to the dom by method "onComplete"
This successfully modify the dom... but not only on the main window (called initially via application.xml config)
Here is my code :
main.html
javascriptHTML Code:<button onclick = "new Test.Window({file: 'test.html'});">New Window()</button><br />
Code:Ext.ns('Test'); (function(){ var Window = Ext.extend(Ext.air.NativeWindow, { closable: true, maximizable: true, minimizable: true, resizable: true, systemChrome: air.NativeWindowSystemChrome.NONE, transparent: true, width: 1024, height: 768, constructor: function(config){ Ext.apply(this, config); Window.superclass.constructor.call(this); this.center(); this.show(); }, onComplete: function () { Ext.DomHelper.append(Ext.get('main').dom, { tag: 'div', html: '--- test ---' }); } }); Test.Window = Window; })();
-
6 Jan 2011 8:23 AM #2
Hi Bouki,
Do you mean "but not only on the main window"? This is what I would expect after seeing your code.
The "Ext" you're calling is the main window's Ext. You have to use:
or better:Code:onComplete: function () { var wExt = this.getWindow().Ext; wExt.DomHelper.append(wExt.get('main').dom, { tag: 'div', html: '--- test ---' }); Window.superclass.onComplete.call(this); // don't forget it, it fires the complete event }
If you want to create toolbars, panels - ext components in general - think about Ext.air.Window!Code:onComplete: function () { var wExt = this.getWindow().Ext; wExt.fly('main').createChild({ tag: 'div', html: '--- test ---' }); Window.superclass.onComplete.call(this); }
makanaProgramming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)
Enhanced ExtJS adapter for Adobe AIR
-
6 Jan 2011 8:39 AM #3
thanks a lot, this is exactly what I was looking for
and sorry for my mistake in the explaination
-
7 Jan 2011 3:29 AM #4
I'm also looking for a way to transmit datas between my windows, by passing them to the constructor
for instance I would like to do new Test.Window{variables: {a: 1, b: 2}}; and then be able to retrieve "a" and "b" from my page
I tried to achieve this by appending to the head markup
but this doesn't works because the page is already loadedHTML Code:<script type="text/javascript">var datas = {a: 1, b: 2}</script>
is there a simple way to do that ?
-
7 Jan 2011 8:34 AM #5
Bouki,
all Ext.air.NativeWindows (try to) register by default in the Ext.air.NativeWindowManager within the main window. You can use it to access all the windows via their ids. Then use the getWindow method to get access to the dom window object of the window.
e.g.
As cou can see there's an easier way for the main window's dom window object.Code:myWindow.manager.get('idOfMyMainExtAirNativeWindowInstance').getWindow(); // or Ext.air.App.getRootHtmlWindow().Ext.air.NativeWindowManager.get('myId').getWindow();
makanaCode:Ext.air.App.getRootHtmlWindow();
Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)
Enhanced ExtJS adapter for Adobe AIR
Similar Threads
-
calling windows/dialogs made in an external JS file?
By foxofinfinety in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 7 Sep 2010, 12:28 PM -
Multiple windows issue
By edsarro in forum Ext 3.x: Help & DiscussionReplies: 5Last Post: 1 Apr 2010, 11:27 AM -
multiple windows and modal
By mmasters in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 26 Aug 2009, 8:58 PM -
[Help!] Multiple Windows within layout
By Leonhart in forum Ext 2.x: Help & DiscussionReplies: 8Last Post: 11 Jul 2008, 7:45 AM


Reply With Quote