R
Rhino
I am trying to understand the proper technique for dismissing a form when I
am done with it.
My MIDlet, whose main class is MemberManager, displays a list of members of
an organization which the user can scroll. In addition, it provides buttons
or menu items to Add new members, Change data for members, and Delete
members. When they choose to Add a member, a Form containing input text
fields is displayed; the user enters data into those fields and presses one
of two buttons: Insert or Cancel. Insert means the user wants to add the
data to the record store and Cancel means that the user has changed his mind
and wants to return to the member list without adding the new data.
In my code, the logic for that displays the Add form and handles its two
buttons are in a separate class, MemberAddForm. In the button handling logic
in MemberAddForm, the logic for the Cancel button simply says to display an
information Alert that says "Insert cancelled" for 5000 milliseconds, then
display the memberList (a reference to the memberList was passed to the
MemberAddForm class). Here is the actual code:
if (label.equals(CANCEL_INSERT_TEXT)) {
System.out.println(CLASS_NAME + "." + METHOD_NAME + " - User chose " +
CANCEL_INSERT_TEXT + ".");
String msg = "Insert Cancelled.";
Alert cancelled = new Alert("Action", msg, null, AlertType.INFO);
cancelled.setTimeout(5000); //milliseconds
display.setCurrent(cancelled);
return;
}
This code works but after the return is executed, I am still on the Form
that is displayed by the MemberAddForm class, not the newly refreshed
memberList from the MemberManager class. What do I need to do to end the
MemberAddForm gracefully and get back to the member list in the
MemberManager class? I'm looking for something like the dispose() method
that I use when I write dialogs in J2SE.
My main class, MemberManager class, extends MIDlet. My supporting class,
MemberAddForm, extends Form. Is that the right approach or should
MemberAddForm also extend MIDlet? Is that my problem? If MemberAddForm also
extended MIDlet, I could destroy it when I am done with it. I'm a little
confused because my approach in J2SE would be to make MemberAddForm a dialog
that is initiated by a Frame but J2ME doesn't seem to have the concept of a
dialog.
Can anyone shed some light on this for me?
--
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare
am done with it.
My MIDlet, whose main class is MemberManager, displays a list of members of
an organization which the user can scroll. In addition, it provides buttons
or menu items to Add new members, Change data for members, and Delete
members. When they choose to Add a member, a Form containing input text
fields is displayed; the user enters data into those fields and presses one
of two buttons: Insert or Cancel. Insert means the user wants to add the
data to the record store and Cancel means that the user has changed his mind
and wants to return to the member list without adding the new data.
In my code, the logic for that displays the Add form and handles its two
buttons are in a separate class, MemberAddForm. In the button handling logic
in MemberAddForm, the logic for the Cancel button simply says to display an
information Alert that says "Insert cancelled" for 5000 milliseconds, then
display the memberList (a reference to the memberList was passed to the
MemberAddForm class). Here is the actual code:
if (label.equals(CANCEL_INSERT_TEXT)) {
System.out.println(CLASS_NAME + "." + METHOD_NAME + " - User chose " +
CANCEL_INSERT_TEXT + ".");
String msg = "Insert Cancelled.";
Alert cancelled = new Alert("Action", msg, null, AlertType.INFO);
cancelled.setTimeout(5000); //milliseconds
display.setCurrent(cancelled);
return;
}
This code works but after the return is executed, I am still on the Form
that is displayed by the MemberAddForm class, not the newly refreshed
memberList from the MemberManager class. What do I need to do to end the
MemberAddForm gracefully and get back to the member list in the
MemberManager class? I'm looking for something like the dispose() method
that I use when I write dialogs in J2SE.
My main class, MemberManager class, extends MIDlet. My supporting class,
MemberAddForm, extends Form. Is that the right approach or should
MemberAddForm also extend MIDlet? Is that my problem? If MemberAddForm also
extended MIDlet, I could destroy it when I am done with it. I'm a little
confused because my approach in J2SE would be to make MemberAddForm a dialog
that is initiated by a Frame but J2ME doesn't seem to have the concept of a
dialog.
Can anyone shed some light on this for me?
--
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare