Return Value from ModalView

I have a iOSView containing datefield and a actionbutton. The actionbutton is calling ModalView with a DatePicker.
A app global dateVariable is used to store the selected date from the DatePicker (and is working).

When the ModalView is closing the it doesn’t fire the Activate event of the iOSView.

How can I update the datefield with the value from the DatePicker or global dateVariable?

Hi,

You’ll need to use a delegate to let the iOSView know the ModalView is closing and should retrieve the new date information.

Unless the dateVariable is used elsewhere in the code, therefore needing to be “app global”, you could pass the value through the delegate and have a cleaner code structure.

@JrmieLeroy

I think that I understand your answer, but I am unable to program it myself. Do you have an example?

Here’s a simple example.

www.jeremieleroy.com/upload/delegate_example.xojo_binary_project

In this example View2 isn’t modal but the concept is similar.
Just make sure you invoke the delegate with the code that closes the view and not in the Close event (on Modal views I recall the Close event isn’t fired)

@JrmieLeroy , thank you! That is easy to understand!

Thank you for your help!