Art_Gorski
(Art Gorski)
December 21, 2022, 10:05pm
1
So I use mobilescreen.show to drill down a few levels.
Master Detail
--------- --------
Screen1 Screen4
Screen2 Screen4
Screen3 Screen5
I make a selection on Screen5 and want to call a method in Screen3 to update the Screen3 display. But when I try to use
Screen3(Self.ParentSplitView.Master).Screen3Method
I get a crash because the splitview Master is still Screen1.
So my question is how do I access Screen3?
Jeremie_L
(Jeremie_L)
December 21, 2022, 10:19pm
2
If you have iOSKit in your project, you could use the observer pattern .
The code in Screen5 would look like this:
JK_NotificationCenter.MainCenter.PostNotification("ANotificationName", self)
In Screen3.Opening event add this code:
JK_NotificationCenter.MainCenter.addObserver(self, WeakAddressOf NotificationReceived, "ANotificationName", nil)
Add this method to Screen3:
Protected Sub NotificationReceived(aNotification as JK_Notification)
Select case aNotification.Name
Case "ANotificationName"
Screen3Method()
End Select
End Sub
And finally in Screen3.Closing event:
//cleanup
JK_NotificationCenter.MainCenter.removeObserver(self)
3 Likes
Jason_King
(Jason King)
December 22, 2022, 2:04pm
3
One thing I will add - I HIGHLY suggest you make a Constants module and make all string names of notifications a constant so you don’t misspell the string somewhere and have it not work.