A
Aaron Fude
Hi,
I am building a gui in which the user has to (just for an example)
enter personal data. As one of the inputs, the user needs to choose
people he knows from a list. A list (in a modal window) pops up when a
user clicks the button "choose". Then the user picks his contacts from
a list and clicks OK. The modal window closes and another entry in the
main window now contains the list of people selected.
I see one strategy to implement this. It is to attach a listener to
the OK button and when it's clicked the list of selected people is
transfered to the main window. Easy enough.
But could one make an alternative approach work. Is it possible to use
code that looks like this:
Vector<Person> people = chooseFromTheList();
where chooseFromTheList() opens the modal dialog, waits for user to
make the selection and click OK and then actually returns the vector
of selected people.
I hope I was able to formulate my question in a sensible way.
I am building a gui in which the user has to (just for an example)
enter personal data. As one of the inputs, the user needs to choose
people he knows from a list. A list (in a modal window) pops up when a
user clicks the button "choose". Then the user picks his contacts from
a list and clicks OK. The modal window closes and another entry in the
main window now contains the list of people selected.
I see one strategy to implement this. It is to attach a listener to
the OK button and when it's clicked the list of selected people is
transfered to the main window. Easy enough.
But could one make an alternative approach work. Is it possible to use
code that looks like this:
Vector<Person> people = chooseFromTheList();
where chooseFromTheList() opens the modal dialog, waits for user to
make the selection and click OK and then actually returns the vector
of selected people.
I hope I was able to formulate my question in a sensible way.