iOS Screen access from Module

I have an iOS Screen called WinLogin with a boolean Public Property eg isFinishedOpen. From within WinLogin I call a Module Method. Within that Method it has the line:

WinLogin.isFinishedOpen = True

The compile error for this line is: ‘static reference to instance method. Call this on an instance of class WinLogin.WinLogin’.

I have tried defining the iOS Screen using:

Var WinLogin2 As MobileScreen = WinLogin

and passing the iOS Screen as an Object to the Method eg myWinLogin

Var WinLogin3 As WinLogin = MobileScreen(myWinLogin)
Var WinLogin4 As WinLogin = WinLogin(myWinLogin)

But these too give compile errors. How can I access an iOS Screen and its properties from within a Module? Do I have to convert my Module Method to a Class?

Easier solution is to return a Boolean from the Module method and set isFinishedOpen to the returned value.

Other solution:
Define the method like this:

Protected Sub InitFeatures(caller As WinLogin)
  //Do something here
  caller.isFinishedLoading = True
End Sub

Call it like this in WinLogin.Opening event:


Using the Parameter ‘WinLogin As WinLogin’ works (thank you @Jeremie_L), but I need to transfer it as an Object (cross-platform external code). So if I use ‘myWinLogin As Object’ as my parameter instead, I can turn myWinLogin back into WinLogin with:

Var WinLogin As WinLogin = WinLogin(myWinLogin)

Keep in mind that when you write code like that you make it impossible to reach the WinLogin class (as opposed to the instance) altogether from within that method.

You should also check that the parameter is what you think it is with an IsA check before casting it.

1 Like