On Thu, Mar 15, 2012 at 09:58, slah <[email protected]> wrote:

> Hello,
> is it possible to select a page by its caption in a TabView.
> suppose I've  something like:
>
>      tabView.add(new qx.ui.tabview.Page("page1").set({layout : new
> qx.ui.layout.VBox()}));
>      tabView.add(new qx.ui.tabview.Page("page2").set({layout : new
> qx.ui.layout.VBox()}));
>      tabView.add(new qx.ui.tabview.Page("abc3").set({layout : new
> qx.ui.layout.VBox()}));
>      tabView.add(new qx.ui.tabview.Page("page4").set({layout : new
> qx.ui.layout.VBox()}));
>
> how could I make for example the page "page2" the selected one?
>

Something along the lines of this untested code this should work:

var pages = tabView.getChildControl("pane").getChildren();
for (var i = 0; i < pages.length; i++)
{
  // Is this the page we're looking for?
  if (pages[i].getLabel() == "page2")
  {
    // Yup. Select it.
    tabView.setSelection( [ pages[i] ] );

    // No need to search further
    break;
  }
}

Beware, however. When you translate your app to a different language, that
label will change, so if you have hard-coded references to a particular
language string in your code, your app will then fail.

Cheers,

Derrell
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to