Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
johnny1941
Posts: 34
Registered: 09-21-2011
My Carrier: none
Accepted Solution

stack fields on top of one another

hi,

 

I'd like to have either a map field or a list field appear on screen based on the choice of a radio button group. Now I don't want to re-render the map every time the user switches from list to map because the rendering takes a lot of time. So how do I stack the list field and map field on top of one another and bring one of them to the front based on the user's choice?

 

 

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: stack fields on top of one another

I have never tested this, but if you have a screen with a MapField and you pop it, then a bit later, push it again, does it repaint itself.  I'm guessing it will repaint, but will that require a re-render?  I would have thought not.  So can you give this a try and let us know how you get on?

Please use plain text.
Contributor
johnny1941
Posts: 34
Registered: 09-21-2011
My Carrier: none

Re: stack fields on top of one another

How would I do this? I can easily pop the map screen off the stack but then I need to pass a parameter to the previous screen telling it to immediately re-render the map screen (with another parameter specifying if I should render it with the map or list visible).

 

So how do I pass these parameters to the screen? I guess I can add a field to each screen that tells it what to do when it's called but is there a more elegant way?

 

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: stack fields on top of one another

I think we have a misunderstanding here. 

 

If you have a Screen A, that has been painted onto the Display area, and then you push another Screen B on top of that Screen A, when the Screen B on top is popped, then Screen A will be repainted, to get the pixels back as they were.  Usually no other processing will take place.

 

You can see this process in action when you display a menu on the screen.  If you just 'ESC' the menu (i.e. take no action) the area of the screen that was covered by the menu is just repainted. 

 

If you have a Screen X, and you pop it off the stack showing the Screen Y below, and then push Screen X again, it will usually just repaint itself with no other processing.

 

I am not 100% sure that this is what happens for a MapField. 

 

But assuming it did, then you can push the screen with the ListField on top of the Screen with the MapField, and when you pop the screen with the ListField, the screen with the MapField should just display.  Certainly that is my experience.

 

And I think the other way works, though I have not tried it.  In other words, if you create and display a Screen with the MapField, then you pop that Screen (but keep a reference to it) and then push it again (the same Screen Object), it should just display.

 

Perhaps the 'trick' here is that you don't recreate the Screens every time, you create them and retain a reference to them. 

 

Hopefully this makes sense. 

Please use plain text.
Contributor
johnny1941
Posts: 34
Registered: 09-21-2011
My Carrier: none

Re: stack fields on top of one another

Worked like a charm, thanks.:Flowers:

Please use plain text.