Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
steve8820
Posts: 78
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator
Accepted Solution

How to change a tabbedpane active tab from another qml?

Hi,

 

Lets say I have a sheet with few buttons as menu. Say I have three buttons called menu 1, menu 2 and menu 3. Then I have another qml file with tabbedpane with three tabs... I am able to show the tabbedpane when i click on the buttons but how can I change the active tab of the tabbedpane when user click on menu 2 and the active tab change to tab 2? How can i achieve this?

 

Thank you.

Regards,

Steve Chan
New Contributor
xiuchundao
Posts: 8
Registered: ‎04-21-2013
My Device: Z10

Re: How to change a tabbedpane active tab from another qml?

Hi, according to your description, you should assign an id to each tab and tabbedpane. Then in the button onClicked slot you write like these 

onClicked: {
      tabbedpane.activeTab = tab2;
}

 

 

Developer
steve8820
Posts: 78
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator

Re: How to change a tabbedpane active tab from another qml?

Thanks... your reply somehow gave me an idea to do it... I used the property alias to get the tab id and use the javascript to change the activetab with the tab id accordingly and it works now.

Regards,

Steve Chan
Developer
billbsb
Posts: 144
Registered: ‎03-25-2011
My Device: Playbook, Z10 L.E.

Re: How to change a tabbedpane active tab from another qml?

Hi,

if you don't want to put IDs for every tab of your TabbedPane, you can also use indexes.

 

rootTabbedPane.activeTab = rootTabbedPane.at(1);

Please mark your question as solved, it helps everyone.

Cheers.

 

Cheers!
Developer
steve8820
Posts: 78
Registered: ‎04-04-2013
My Device: BB10 Dev Alpha Simulator

Re: How to change a tabbedpane active tab from another qml?

Thanks, my problem solved with your solutions.
Regards,

Steve Chan