03-26-2011 09:25 AM
I am working with different screens in my app.
I have a screen with 4 tabs. Each tab on click should display a different screen on the device. But i want to open the instance of each screen only once and then rotate these screens on the display stack to bring the desired screen to the front and push the remaining to the background.
But the trouble is that when i try using pushScreen() for a screen that has already been displayed once before, i get an error which says that i am trying to push a screen which is already being displayed. But infact the screen is not the currently active screen?? how can i now bring this screen instance to the fore??
can someone tell me how this can be achieved?
Solved! Go to Solution.
03-26-2011 09:28 AM
Once you push a screen, you have to pop it before you can push it again.
The BB display container is organized like a stack.
Now, if you have a reference to the screen, you can pop it from anywhere on the stack, then push it again to redisplay.
03-26-2011 01:34 PM
You may also use a system with one screen containing your 4 tabs and one Manager.
Instead of pushScreen you just replace the manager by another, which contains everything you need to display.
03-27-2011 03:07 PM
I would recommend having a 'manager' per screen, so that you swap just one Manager - this will reduce the overhead.
That said, when I have 'tabbed' screens, I typically have multiple screens rather than attempting to manage multiple managers. I just find this easier. For example, using the multiple screen approach, you can then have the 'tab bar' permanently set to the screen and you don't have t change it.
03-28-2011 08:25 AM
I also preferred the Peter's solution before.
But since OS 6 you have to think with a manager system if you want to use the PaneManager.
By this way I have only a few lines of code to switch from a classic tabbar system with OS < 6.0 to a Pane System with OS6.
04-11-2011 09:04 AM
I have used the push and pop screen method as i was really pressed for time and i was comfortable doing the same. But i feel that the manager option is the better option which i want to use in future. So in this case both solutions tie out but i cant mark both as the accepted solution
So i have accepted the manager option as the solution while giving kudos to the screen push-pop solution hope that makes everyone happy!