Hello Kanugula!

The problem is the way you set reference to the "this" in addEventListener:

// make qx.ui.embed.Iframe react to event "surfTo" via function changeURL()
this.addEventListener(
  "surfTo",
  changeURL,
  mainTabView.getBar().getManager().getSelected().getLabel() == "Search" ?
    search_w :
    mainTabView.getBar().getManager().getSelected().getLabel() == "Buy" ?
      buy_w :
      null
);

The expression "mainTabView.getBar().getManager().getSelected().getLabel()" 
does not seem to be evaluated later and your "this" in "surfTo" remains as it 
was first set. So all changeURL() calls are executed on your first iframe.


You could set the target for setSource() inside changeUrl():

// make qx.ui.embed.Iframe react to event "surfTo" via function changeURL()
this.addEventListener(
  "surfTo",
  changeURL
);


function changeURL(e) {
  var target = (mainTabView.getBar().getManager().getSelected().getLabel() == 
"Search") ?
        search_w :
        buy_w;

  target.setSource(e.getData());
};


Cheers,
Jonathan

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von kanugula
Gesendet: Donnerstag, 3. April 2008 17:17
An: qooxdoo-devel@lists.sourceforge.net
Betreff: [qooxdoo-devel] What is wrong with my second IFrame?


Experts,

I am dangling my head to fix my 2nd IFrame issue.

I have two tabs. One to serach and other to buy. My search tab works greate
and fills the IFrame. When I click 2nd Tab, it fetched remote web site, but
it doesn't fill my Iframe.

Can somebody poibnt the error please? I suspect, this.setSource() is not
going to right IFrame.

If you have better suggestions, pls suggest. Most of the code is built on
Demo Browser/IFrame1.html

<script type="text/javascript">
        qx.Class.define("Test",
        {
    extend : qx.application.Gui,

    events :
    {
      "surfTo" : "qx.event.type.DataEvent"
    },

    members :
    {

      main : function()
      {
        this.base(arguments);
                var d = qx.ui.core.ClientDocument.getInstance();

                var mainTabView = new qx.ui.pageview.tabview.TabView;
                mainTabView.setEdge(20);

                var search_b = new qx.ui.pageview.tabview.Button("Search");
                var buy_b = new qx.ui.pageview.tabview.Button("Buy");

                search_b.setChecked(true);

                mainTabView.getBar().add(search_b, buy_b);

                var search_p = new qx.ui.pageview.tabview.Page(search_b);
                var buy_p = new qx.ui.pageview.tabview.Page(buy_b);

                mainTabView.getPane().add(search_p, buy_p);


                //-----------
        // search Iframe
        //-----------

        var search_w = new qx.ui.embed.Iframe();

        search_w.addEventListener("load", function(e) {
          this.debug("Loaded: " + this.getSource());
        });

        // elastic
        search_w.setEdge(20);
        search_w.setTop(30);


                //-----------
        // buy Iframe
        //-----------
        var buy_w = new qx.ui.embed.Iframe();

        buy_w.addEventListener("load", function(e) {
          this.debug("Loaded: " + this.getSource());
        });

        // elastic
        buy_w.setEdge(20);
        buy_w.setTop(30);

                search_p.add(search_w);
        buy_p.add(buy_w);


        function changeURL(e) {
          this.setSource(e.getData());
        };

        // make qx.ui.embed.Iframe react to event "surfTo" via function
changeURL()
        this.addEventListener("surfTo", changeURL,
mainTabView.getBar().getManager().getSelected().getLabel() == "Search" ?
search_w : mainTabView.getBar().getManager().getSelected().getLabel() ==
"Buy" ? buy_w : null);


        //----------------
        // search radio group
        //----------------

        var search_rd_1 = new qx.ui.form.RadioButton("Google",
"http://www.google.com";);
        var search_rd_2 = new qx.ui.form.RadioButton("Yahoo",
"http://www.yahoo.com";);

        search_rd_1.set( { left: 20, top: 5 } );
        search_rd_2.set( { left: 140, top: 5 } );

        var search_rbm = new qx.ui.selection.RadioManager( name,
[search_rd_1, search_rd_2]);

        // elements of radio group fire event "surfTo"
        search_rbm.addEventListener("changeSelected", function(e)
        {
          this.dispatchEvent( new qx.event.type.DataEvent("surfTo",
e.getValue().getValue() ) );
        }, this);

        search_p.add(search_rd_1, search_rd_2);


        //----------------
        // buy radio group
        //----------------

        var buy_rd_1 = new qx.ui.form.RadioButton("Dell",
"http://www.dell.com";);
        var buy_rd_2 = new qx.ui.form.RadioButton("Amazon",
"http://www.amazon.com";);

        buy_rd_1.set( { left: 20, top: 5 } );
        buy_rd_2.set( { left: 140, top: 5 } );

        var buy_rbm = new qx.ui.selection.RadioManager( name, [buy_rd_1,
buy_rd_2]);

        // elements of radio group fire event "surfTo"
        buy_rbm.addEventListener("changeSelected", function(e)
        {
          this.dispatchEvent( new qx.event.type.DataEvent("surfTo",
e.getValue().getValue() ) );
        }, this);

        buy_p.add(buy_rd_1, buy_rd_2);



                d.add(mainTabView);

      }

    }
        });

  qx.core.Init.getInstance().setApplication(new Test);
  </script>
-- 
View this message in context: 
http://www.nabble.com/What-is-wrong-with-my-second-IFrame--tp16467555p16467555.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to