Bug? Screen object initialize

stevel05

Expert
Licensed User
Longtime User
I tried to get the screen size from the screen object,

B4X:
Dim S As Screen
Log(S.MinX&","&S.MinY&","&S.MaxX&","&S.MaxY)

but just get an error that says
Object should first be initialized (screen)

There is no initialize method for Screen.
 

stevel05

Expert
Licensed User
Longtime User
Ok, I got it. It needs to be used in conjunction with fx.screens.

B4X:
Dim SList As List = fx.Screens
For Each S As Screen In SList
    Log(S.MinX&","&S.MinY&","&S.MaxX&","&S.MaxY)
Next

Or static calls to Screen via reflection
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
I was thinking more of using Screen.getScreensForRectangle to work out which monitor the app was currently on and the best place to open a new window when necessary.
 
Top