Link to home
Start Free TrialLog in
Avatar of OleSetnes
OleSetnes

asked on

How to return data from a pop up view to the calling class

Can anyone suggest a smart way of returning data from a pop up view to the calling class. I can think of a number of rather complicated methods with protocols or pointers to structures in the calling class.

The problem is generic. I have a view and I need to prompt for some user input. Therefore I load another view that prompts for the data. After the user has entered the data and clicked OK the data has to be passed back to the calling class.

What is the smartest way to do that?
Avatar of darbid73
darbid73
Flag of Germany image

I am not sure there is a "right answer" to your question.  

The one I recently used was I passed a reference to my calling class to the popup view class.  

My calling class had properties for the data that is got from the popup view.

So when the user gave some input on the popup view its class could simply add this to the property of the calling class.
ASKER CERTIFIED SOLUTION
Avatar of OleSetnes
OleSetnes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As I said there is not a "right answer".

I prefer passing things around but I am not a professional programmer and I think the "professional way" is with protocols.  

It is complicated but if you get used to protocols they could be used more often.
Whilst i do not  intend to object as you have used another method, I have answered your question and answered it correctly.

Either with or without my help you have been able to decide that another method is possible which I also told you is possible and evaluate which method you will now use.

If you want to look at it strictly I have at least answered your question to 50% and you can also split points on EE.
Avatar of OleSetnes
OleSetnes

ASKER

The best I could come up with.