07-26-2010 06:34 AM - last edited on 07-26-2010 06:50 AM
Hi, I'm trying to create a dialog with only a cancel button. I've extended the dialog class to do this in the constructor:
public SessionDialog(String title){
super(dialogResponse, title, dialogResponse, null, dialogResponse);
Manager manageLayout = new HorizontalFieldManager( VERTICAL_SCROLLBAR);
ButtonField b =new ButtonField("Cancel",Field.FIELD_HCENTER);
manageLayout.add(b);
add(manageLayout);
}
And call it like this:
SessionDialog d =new SessionDialog( "Please Wait, creating session");
d.show();
However I still get a dialog with ok and cancel buttons, how do I just get the cancel button to show?
Thanks
Solved! Go to Solution.
07-26-2010 06:39 AM
i would suggest to use a standard popupscreen. dialog is a specialized popupscreen, if you need something out of its scope its better to do it yourself
07-26-2010 06:48 AM
Can you give me an example of a PopUpScreen with only a cancel button and how to show it? I have a custom update method in my Dialog class which I'm rather keen to retain so I'd really like to solve this by keeping my Dialog class if at all possible
Thanks
07-26-2010 07:15 AM
You might find the Please Wait screen in here useful:
07-26-2010 09:19 AM
Dialog with Cancel button only:
UiEngine ui = Ui.getUiEngine();
Dialog cancelPrompt = new Dialog("Loading...", new String[] { "Cancel" }, new int[] { Dialog.CANCEL }, Dialog.CANCEL, Bitmap.getPredefinedBitmap(0));
ui.pushGlobalScreen(cancelPrompt, 1, UiEngine.GLOBAL_MODAL);
// use cancelPrompt.close() to close the Dialog automatically from another thread or method
07-26-2010 10:16 AM
Ok thanks for the replies, RE the last response, how do I add a listener to that Dialog for the cancel button. Also how do I pop that Dialog from a background thread?
many thanks
07-26-2010 11:55 AM
Figured both out. Listener can be created during the Dialog creation like so:
Thanks for your replies guys