Skip to main content

dialog issue

7 replies [Last post]
buffon
Offline
Joined: 2010-09-29
Points: 0

how do i dispose a custom dialog with a button on the dialog.am using the new lwuit editor to generate the dialog and the button. tanxs

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07
Points: 0

Either use a command since they implicitly dispose dialogs or invoke ((Dialog)Display.getInstance().getCurrent()).dispose();

buffon
Offline
Joined: 2010-09-29
Points: 0

thanks vprise for your usual rapid responce..the problem stil persist as the button am using to dispose the dialog is not working. the dialog is a custom wait dialog for an onlne processing, i have a buuton on the dialog that the user can use to terminate the process, but the button does not dispose off the dialog if an error occurs.

vprise
Offline
Joined: 2003-11-07
Points: 0

What sort of error?

If an exception is thrown in the LWUIT EDT we try to catch it and show an error dialog so you will know what happened, this might cause some issues with two open dialogs.

Its hard for me to help you without knowing the nature of the error, if you can reproduce it with a debugger that usually helps allot, if you have a stack trace it might also help.

buffon
Offline
Joined: 2010-09-29
Points: 0

when for instance dere is no internet sevice on the device, an unknown host exception is appropriately thrwon, now the problem is a dialog shows the message(excepion message). the diallog can be closed but the custom progress dialog with a close button refuses to dispose the dialog. i think like you rightly said there is an issue with two open dialogs.. please i dont know what to do, pls help. tanks

vprise
Offline
Joined: 2003-11-07
Points: 0

How did you create the progress indicator and the network connection?

Generally when an error occurs you should dispose of the progress dialog.

buffon
Offline
Joined: 2010-09-29
Points: 0


i

I used the resource editor to create a dialog, of course from the list of forms in the editor, I selected the dialog. I have a rotating animation created with the timeline image from gif placed at the center. Now what I have is dis after wen the waitDialog shows

protected void postWaitDialog(Form f) {
// If the resource file changes the names of components this call will break notifying you that you should fix the code
super.postWaitDialog(f);
new Thread()
{
public void run()
{
login(username, password);
}
}.start();

public void login(final String username,final String password)

{

try

{

ConnectionRequest myRequest = new ConnectionRequest();

myRequest.setUrl("url");

NetworkManager.getInstance().addToQueue(myRequest);

myRequest.addResponseListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

NetworkEvent ev = (NetworkEvent)ae;

byte[] data = (byte[])ev.getMetaData();

String webmsg = new String(data);

if(webmsg.length()>0)

webmsg.trim();

if(webmsg.length()== 16)

{

showForm("MainForm", ae.getCommand());

}

else

// if(webmsg.length() == 14)

// {

Dialog.show("", webmsg, "Ok", "Cancel");

}

});

}

catch(Exception error)

{

System.out.println("Caught IOException: " + error.toString());

}


vprise
Offline
Joined: 2003-11-07
Points: 0

Is the dialog that's blocking you the web message one that you are showing?

If so you can just dispose the current dialog before showing it.

If its an internal dialog shown by LWUIT4IO on connection errors you can use NetworkManager.addErrorListener to add an action listener that will be invoked on an IO/Runtime exception in network connections. When a listener like that is registered it can consume the action event it receives (ev.consume()) hence blocking further error messages.

Alternatively you can also override the ConnectionRequest's handleIOException for the default event handling.