Access control on other mobile screen

How Do you Access a control ( textfield) on a different mobilescreen.

Example: When User returns from a screen back to a calling screen (parent Screen) I need to update fields on the calling screen (parent Screen).

I can’t figure out how to get pointer to Other Screen.
Documentation shows MobileScreen.ViewControllerHandle As** [Ptr] etc… but no examples of how to use it.
Thx in Advance


When you return back to a calling screen, that screen activates and will automatically reload everything. The calling screen on the stack is not static.

Now if on a split screen layout you change something on the master screen and then want something to update on the detail screen, you would use something like this, where “MyScreen” is the name of the detail screen:

MyScreen(Self.ParentSplitView.Detail).MyDataLabel.Text = “Not Specified”

Thx Art !

not up to speed on this method so I will look for example/instructions on how to implement.
Thank You For Your Help…

Very quick reply as I don’t have much time to get into the details of this.

  1. Basic way
    Have a set of properties in a Module. In the MobileScreen.Activate event check if these properties hold new values you should use to update the UI.

  2. Delegate / callback
    Set a Delegate method the child view should callback to, using the delegate.invoke method.
    The child view will call that to update the UI with whatever values you need.

  3. Notification observer
    Using Jason King’s iOSKit, use the notification observer pattern to send the new values needed to update the UI.

1 Like

Jeremie’s number 1 uses a module to hold data which is shared by the views.
When a view refreshes itself, it takes the current values of these properties and displays them

Another method which I have used:

In a module, add a property for each screen type
So if you have SettingsView, DesignView, and ColorsView, create properties:

theSettings as SettingsView
theDesign as DesignView
theColors as ColorsView

When each of these views is opened or created, have them update these properties

//(eg for Settings View)
theSettings = self

Later, if you want to affect the text property of a control called txtCurrentDesign which lives on the SettingsView, your code will look like this:

if theSettings <> nil then 
theSettings.txtCurrentDesign.text = "Some words"
end if

For some controls you may need to include a call to refresh

Jeremie, Thank You.

Jeff, Thank You.
your example was exactly what I needed. I do want to learn about delegates and declares though…

The Notification Observer code in iOSKit is actually pure Xojo. You can copy that module into a desktop/web/etc project and use it without changes there. It’s the only module in iOSKit without declares