I created a simple "Confirm Delete" Alert dialog, and ended up with this
code:
String title = "Confirm delete"?";
new Alert(MessageType.QUESTION, title, new ArrayAdapter(new String[] {
"Delete", "Cancel" })).open(window, new DialogCloseListener() {
public void dialogClosed(Dialog dialog, boolean modal) {
do something with ((Alert)dialog).getSelectedOption());
}
});
It would be nice if I didn't need to add the noice in the ArrayAdapter
constructor, so I could write:
new ArrayAdapter("Delete", "Cancel"). I can imagine this would be handy
in many situations.
The fix is to change the constructor in ArrayAdapter from:
public ArrayAdapter(T[] array)
to
public ArrayAdapter(T... array)
-- Edvin