Multiple displays on android
Posted: Wed Apr 15, 2026 8:17 pm
I found when opening a second display on android I can not get the mouse coordinates to work as normal.
Also the second display will not hide the titlebar
This example works on both displays on windows, but on android it will only return mouse posistions as 0 when on display 2
Also the second display will not hide the titlebar
This example works on both displays on windows, but on android it will only return mouse posistions as 0 when on display 2
Code: Select all
@DISPLAY {Title = "Main Display", Width = 1366, Height = 768, ScaleMode = #SCALEMODE_AUTO, Orientation = #ORIENTATION_LANDSCAPE, FitScale = True, SmoothScale = True, HideTitleBar = True}
SetFillStyle(#FILLCOLOR)
SetFont(#SANS, 36)
window = 1
Box(1300, 0, 68, 50, #BLUE)
Function p_HandlerFunc(msg)
Switch(msg.Action)
Case "OnMouseDown":
xpos = MouseX()
ypos = MouseY()
If xpos > 1300 And ypos < 50
If window = 1
CreateDisplay(2, {Title = "Display 2", width = 1366, height = 768, Color = #WHITE, ScaleMode = #SCALEMODE_AUTO, Orientation = #ORIENTATION_LANDSCAPE, FitScale = True, SmoothScale = True, HideTitleBar = True})
OpenDisplay(2)
window = 2
Box(1300, 0, 68, 50, #RED)
InstallEventHandler({ OnMouseDown = p_HandlerFunc, CloseWindow = p_HandlerFunc })
Else
SelectDisplay(1)
CloseDisplay(2)
window = 1
EndIf
Else
Box(100, 100, 200, 200, #SILVER)
TextOut(120, 120, "X = "..xpos)
TextOut(120, 160, "Y = "..ypos)
EndIf
Case "CloseWindow":
If window = 1
End
Else
SelectDisplay(1)
CloseDisplay(2)
window = 1
EndIf
EndSwitch
EndFunction
InstallEventHandler({ OnMouseDown = p_HandlerFunc, CloseWindow = p_HandlerFunc })
Repeat
WaitEvent()
Forever