Hi,
I was not able to reproduce the problem you describe.
Here is what I tried:
Code:
import javax.microedition.midlet.*;
import org.eclipse.ercp.swt.mobile.Command;
import org.eclipse.ercp.swt.mobile.ListBox;
import org.eclipse.ercp.swt.mobile.ListBoxItem;
import org.eclipse.ercp.swt.mobile.MobileShell;
import org.eclipse.ercp.swt.mobile.TimedMessageBox;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Template extends MIDlet implements Runnable {
private Thread UIThread;
private Display display;
private Shell shell;
public void startApp() {
if (UIThread == null) {
UIThread = new Thread(this);
UIThread.start();
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
shell.dispose();
}
public void run() {
display = new Display();
shell = new MobileShell(display, 0, MobileShell.SMALL_STATUS_PANE);
shell.setText("MobileShell");
shell.setLayout(new FillLayout(SWT.VERTICAL));
final ListBox list = new ListBox(shell, SWT.V_SCROLL, ListBox.LB_STYLE_2LINE_ITEM);
ListBoxItem[] items = new ListBoxItem[100];
for (int i = 0; i < items.length; i++) {
items[i] = new ListBoxItem(i + " item", null, i + " item", null);
}
list.setDataModel(items);
list.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent arg0) {
list.removeSelectionListener(this);
Shell s = new Shell(shell);
s.open();
TimedMessageBox dlg = new TimedMessageBox(shell, SWT.ICON_WORKING);
dlg.setMessage("Please wait");
dlg.open();
}
public void widgetSelected(SelectionEvent arg0) {
}});
Command cmd = new Command(shell, Command.EXIT, 0);
cmd.setText("Exit");
cmd.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent arg0) {
}
public void widgetSelected(SelectionEvent arg0) {
shell.dispose();
}});
shell.layout();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
notifyDestroyed();
}
}