APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Change Tab on click post and replies

Return to the Change Tab on click thread
Login to post to this thread

Change tab panel onclick
Apostolos Michaloudis
28 Posts

Hello!
I have created aTabbedPanel with three tabs, let's say tabA, tabB and tabC.

Is it possible, when i click on a button, to change to the desired tab?

For example, i am on tabA.
By clicking a button, i want to go to tabB, without the traditional method of clicking on the tab tabB.

I hope you understood, sorry for my english!


Replies to Change tab panel onclick

Re: Change tab panel onclick -
Francisco Esquembre
228 Posts

Sure!

_view.tabbedPanel.setSelectedIndex(tabIndex);

does the trick. Tabs are indexed staring from 0, for the first tab.

Note: There is a Selected property that you na use for this, too. But I just discovered that it has a bug and does not work for the first tab.

I corrected it. Next release will have the bug fix.

Paco



Re: Re: Change tab panel onclick -
Apostolos Michaloudis
28 Posts

Thanks mr Esquembre!



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book