Hi All,

I use IFrames to host a wiki inside my application.  I wanted to be able
to reach out from the wiki code to manipulate the qooxdoo portion of my
application.  Very similiar to your question.  Here are the key things
that I discovered that made everything possible:

1) If your normal class hierarchy is called X.Y.Z, then from within the
iframe, simply reference it by using "parent.X.Y.Z":

<script type="text/javascript">
var license = parent.zed.LicenseCode.getInstance();
if(license){
  document.write("LicenseCode found!<br/>");
} else {
  document.write("LicenseCode not found!<br/>");
}
</script>

2) In both Firefox and IE I found that you can find the IFrame DOM
element by using "window.frameElement".  This is important, because to
get the object reference to the QooxDoo IFrame class, you then use
"window.frameElement._QxIframe".  Once you have that, you can navigate
parent hierarchies, etc:

<script type="text/javascript">
document.write(window);
document.write("<br/>");
if(window.frameElement._QxIframe){
  document.write("window.frameElement._QxIframe is available");
} else {
  document.write("window.frameElement._QxIframe doesn't exist");
}
</script>

3) If you have static utility methods in your class hierarchy, this
makes it possible to access them, and pass information from your iframe:

Here is a button that launches task ID: 1<br/>
<button
onclick="parent.zed.tracker.TaskPage.launchTaskEditor( 
window.frameElement._QxIframe, 1);">Task: 1</button>

Hope that helps,

Steven

On Wed, 2008-03-05 at 09:15 +0000, bibliograph wrote:
> Hi,
> 
> you can only do that if the iframe content is loaded from the same 
> domain as your qooxdoo application. You can then do the following (not 
> tested, might contain typos or bugs):
> 
> yourIframe.addEventListener("load",function(){
>     this.getContentWindow().setContainerWindow(yourWindow);
> },this);
> 
> in your iframe, add the following script:
> 
> <script>
>     function setContainerWindow(cw){
>        window._containerWindow = cw;
>     }
>     function getContainerWindow(){
>        return window._containerWindow;
>     }
> 
>     ... your code ...
> 
>     getContainerWindow().close();
> 
> 
> </script>
> 
> Hope this helps...
> 
> Chritian
> 
> 
> pwoods3781 schrieb:
> > I have a qx.ui.window.Window containing a qx.ui.embed.Iframe.  When the
> > user is done with the task in the Window/Iframe I would like to provide a
> > "Close" link that will close the Window.  Can loading into the Iframe
> > source something like the following work?
> >
> > <head>
> > <script type="text/javascript">
> > [code to access a function in my main app that .close()'s the window]
> > </script>
> > ...
> >
> > Any help would be appreciated.
> >
> > Paul
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > qooxdoo-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >   
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to