Now I have changed my application code to something like this based on your
inputs:
Main application:
qx.Class.define("my.application.Main",
{
extend : qx.application.Gui,
statics :
{
frameTop: new qx.ui.embed.Iframe("top.html"),
frameMain: new qx.ui.embed.Iframe("default.html"),
frameBottom: new qx.ui.embed.Iframe("status.html"),
setMainFrameSource: function(frameSource)
{
var d = qx.ui.core.ClientDocument.getInstance();
d.dispatchEvent( new qx.event.type.DataEvent("surfTo", frameSource
) );
}
},
members :
{
main : function()
{
// Call super class
this.base(arguments);
var d = qx.ui.core.ClientDocument.getInstance();
//Set properties for IFrames
my.application.Main.frameTop.setTop(0);
my.application.Main.frameTop.setLeft(0);
my.application.Main.frameTop.setWidth("100%");
my.application.Main.frameTop.setHeight(100);
my.application.Main.frameTop.setBorder(null);
d.add(my.application.Main.frameTop);
my.application.Main.frameMain.setLeft(0);
my.application.Main.frameMain.setTop(100);
my.application.Main.frameMain.setWidth("100%");
my.application.Main.frameMain.setBottom(30);
my.application.Main.frameMain.setBorder(null);
d.add(my.application.Main.frameMain);
my.application.Main.frameBottom.setLeft(0);
my.application.Main.frameBottom.setWidth("100%");
my.application.Main.frameBottom.setBottom(30);
my.application.Main.frameBottom.setBorder(null);
d.add(my.application.Main.frameBottom);
// make qx.ui.embed.Iframe react to event "surfTo" via function
changeURL()
d.addEventListener("surfTo", this.setMainFrame,
my.application.Main.frameMain);
},
setMainFrame: function(e) {
alert("Setting...");
my.application.Main.frameMain.setSource(e.getData());
}
}
});
Application 1 : set to frameTop IFrame:
qx.Class.define("my.application.TopNavigation",
{
extend : qx.application.Gui,
members :
{
__mainNavToolbar: null,
main : function()
{
// Call super class
this.base(arguments);
__mainNavToolbar = new qx.ui.toolbar.ToolBar;
__mainNavToolbar.setLeft(200);
__mainNavToolbar.setRight(100)
__mainNavToolbar.setTop(50);
var tbp = new qx.ui.toolbar.Part;
var btnHome = new qx.ui.toolbar.Button("Home",
"resource/qx/icon/VistaInspirate/22/actions/go-home.png");
btnHome.addEventListener("execute", function(e) {
my.application.Main.setMainFrameSource("test.html");
}
);
tbp.add(btnHome);
__mainNavToolbar.add(tbp);
__mainNavToolbar.addToDocument();
}
}
});
Now, the error has disappeared. I am able to access the IFrame from the
my.application.Main class. But, when I dispatch the surfTo event from the
static method the function registered to handle it is not getting called. No
error in Firebug or FF error console.
I think this is not a trivial issue.
Thanks,
Phaneesh
----- Original Message ----
From: thron7 <[EMAIL PROTECTED]>
To: qooxdoo Development <qooxdoo-devel@lists.sourceforge.net>
Sent: Tuesday, August 21, 2007 12:04:18 AM
Subject: Re: [qooxdoo-devel] Access one application class instance from another
application
Phaneesh,
you need to make accessible the Iframe widgets you create, e.g. through
a variable of your "master" Application class, so one Iframe widget can
get hold of the other during runtime.
Let's suppose you saved all your Iframes in an array "allMyIframes" of
your master Application class, then you can access one of them from an
Iframe app like this:
if (parent && parent.qx != window.qx) {
var mySecondIframe =
parent.qx.core.Init.getInstance().getApplication().allMyIframes[1];
...
Now you should be able to invoke your desired method:
mySecondIframe.setMainFrame("default.html");
The saving of the Iframe widgets to the parent app works the same way
(e.g. through
"parent.qx.core.Init.getInstance().getApplication.addIframe(this.frameMain);"
which would add to the allMyIframes array).
(Alternatively to using the parent app as a keeper for your Iframe
widgets you could use a static array of your com.myapplication.Main
class, but only if all three embedded iframes are implemented using this
class.)
The problem with your approach is that you are calling an instance
method as if it were a class (static) method, hence the error message.
HTH,
=Thomas
Phaneesh N wrote:
> Hi,
>
> Thanks for the response. Let me explain my problem in detail. I have 1
> application with 3 IFrames. I have set 3 different applications to
> these 3 IFrames. Now, there is a Toolbar in one of the application in
> a IFrame. On click of the a toolbar button I have to change the
> application that is set for another IFrame.
>
> Can you please assist me in doing this.
> Thanks,
> Phaneesh
>
> ----- Original Message ----
> From: dperez <[EMAIL PROTECTED]>
> To: qooxdoo-devel@lists.sourceforge.net
> Sent: Monday, August 20, 2007 6:40:03 PM
> Subject: Re: [qooxdoo-devel] Access one application class instance
> from another application
>
>
> You can try something like this:
>
> sghe.udctc.utest.Main.setMainFrame.call("default.html",
> parent);
>
> to set 'this' to window.parent
>
>
> Phaneesh N wrote:
> >
> >
> > Hi All,
> > I am developing my application in 0.7.1.
> > I have two applications classes [set to two qx.embed.IFrame]. I want to
> > call a member method of application 1 from application 2. Here is the
> > code:
> >
> > Application 1:
> > qx.Class.define("com.myapplication.Main",
> > {
> > extend : qx.application.Gui,
> > statics :
> > {
> > setMainFrame: function(frameSource) {
> > this.frameMain.setSource(frameSource);
> > }
> > },
> > members :
> > {
> > frameMain: null,
> > main : function()
> > {
> > // Call super class
> > this.base(arguments);
> >
> > //Set properties for IFrames
> > this.frameMain = new qx.ui.embed.Iframe("default.html");
> > this.frameMain.setLeft(0);
> > this.frameMain.setTop(100);
> > this.frameMain.setWidth("100%");
> > this.frameMain.setBottom(30);
> > this.frameMain.setBorder(null);
> > this.frameMain.addToDocument();
> > }
> > }
> > });
> >
> > In Application 2:
> > var btnHome = new qx.ui.toolbar.Button("Home",
> > "resource/qx/icon/VistaInspirate/22/actions/go-home.png");
> > btnHome.addEventListener("execute", function(e) {
> > sghe.udctc.utest.Main.setMainFrame("default.html");
> > }
> > );
> >
> > But I get this.frameMain has no properties error. Please tell me am I
> > missing something here?
> >
>
> --
> View this message in context:
> http://www.nabble.com/Access-one-application-class-instance-from-another-application-tf4290088.html#a12235659
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> ------------------------------------------------------------------------
> Moody friends. Drama queens. Your life? Nope! - their life, your story.
> Play Sims Stories at Yahoo! Games.
> <http://us.rd.yahoo.com/evt=48224/*http://sims.yahoo.com/>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> ------------------------------------------------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel