What is the correct way to programtically move a user to a certain tab?
My application has a group of data driven forms on a series of tabs. These tabs are torn down and rebuilt every CRUD operation (because the number and types of them can change).
Because I'm tearing them down and rebuilding them, every time the user hits the save button he arrives back at the zero-th tab. Can anyone give me suggestions on how to accomplish this?
I'm struggling to do it right now. When I call getTabIndex to try and save what tab the user is on right now I usually get 0 back.
I've tried using setActiveWidget to move the user back. I save a reference to a tab and then after rebuild try to use it but because my saved reference of a tab is now gone, the tabPanel won't match against it.
I don't understand the problem - are you saying that tabPanel.setActiveWidget(tabPanel.getWidget(0)) isn't selecting the zeroth tab and showing its contents?
TabPanel implements IndexedPanel to allow iterating through the widget children. There is also a findItem(String,boolean) method that searches the tab text and returns the matching widget.
The getTabIndex()/setTabIndex(int) methods are totally unrelated to this - these methods are defined in Component, and refer to how the browser handles the tab key when moving from the focused element to the next (currently unfocused) element.
I don't understand the problem - are you saying that tabPanel.setActiveWidget(tabPanel.getWidget(0)) isn't selecting the zeroth tab and showing its contents?
TabPanel implements IndexedPanel to allow iterating through the widget children. There is also a findItem(String,boolean) method that searches the tab text and returns the matching widget.
The getTabIndex()/setTabIndex(int) methods are totally unrelated to this - these methods are defined in Component, and refer to how the browser handles the tab key when moving from the focused element to the next (currently unfocused) element.