BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   How can I show a modal dialog as a status screen? (http://www.blackberryforums.com/showthread.php?t=175493)

GasBot 02-11-2009 02:13 AM

How can I show a modal dialog as a status screen?
 
When my app first starts up, I have it calling my web service and looking to see if there are any updates to the app. I would like to let the user know this by having the screen grayed out with a message saying that the app is checking for updates which doesn't allow them to do anything until a response has been returned. I'm seeing a bunch of stuff about the PopupScreen, but am having trouble implementing it. Anyone have any working code for this?

simon.hain 02-11-2009 05:32 AM

popupscreen is a quite easy to use class. just create a manager, put it into the popupscreen and use pushModalScreen to "block" the application from input.

you have to include elements that close the screen, of course. for example overwrite navigationclick or keychar etc

GasBot 02-12-2009 02:47 AM

Quote:

Originally Posted by simon.hain (Post 1280350)
popupscreen is a quite easy to use class. just create a manager, put it into the popupscreen and use pushModalScreen to "block" the application from input.

you have to include elements that close the screen, of course. for example overwrite navigationclick or keychar etc

Sorry, I'm pretty new to BlackBerry development, but do I have to use the VerticalFieldManager as the manager for a PopupScreen? Here's the code that I have so far, I'm assuming I need to change my last line to the pushModalScreen function?

Code:

final VerticalFieldManager mgr = new VerticalFieldManager(VerticalFieldManager.NO_HORIZONTAL_SCROLLBAR |
                                                                  VerticalFieldManager.NO_VERTICAL_SCROLLBAR |
                                                                  VerticalFieldManager.USE_ALL_HEIGHT |
                                                                  VerticalFieldManager.USE_ALL_WIDTH);
        PopupScreen pps = new PopupScreen(mgr, PopupScreen.DEFAULT_CLOSE);
        getScreen().getUiEngine().pushScreen(pps);


GasBot 02-12-2009 03:10 AM

So it turns out that I can't use pushModalScreen because that stops the code from executing further. I changed it over to pushScreen which didn't stop the code from executing, but I didn't see the PopupScreen. Does anyone have some example code of a PopupScreen used just as a status screen to keep the user from doing anything while the background processing is going and then having the app automatically close the popup when it was done with the operation?

simon.hain 02-12-2009 04:25 AM

use invokelater to put your ui access into the event queue, your app will continue to run.
use pushModalScreen to block the input to your app


All times are GMT -5. The time now is 04:57 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.