Multiple displays on android

Find quick help here to get you started with Hollywood
Post Reply
amyren
Posts: 456
Joined: Thu May 02, 2019 11:53 am

Multiple displays on android

Post by amyren »

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

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
User avatar
airsoftsoftwair
Posts: 5953
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Multiple displays on android

Post by airsoftsoftwair »

Ok, looks like a bug. Will be fixed.
amyren
Posts: 456
Joined: Thu May 02, 2019 11:53 am

Re: Multiple displays on android

Post by amyren »

airsoftsoftwair wrote: Sun Apr 19, 2026 9:37 pm Ok, looks like a bug. Will be fixed.
Thanks.
As you may be aware of already, when using HGUI on Android it also have similar issues when opening a window. Could it be that it is caused by the same bug?
User avatar
airsoftsoftwair
Posts: 5953
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Multiple displays on android

Post by airsoftsoftwair »

amyren wrote: Mon Apr 20, 2026 1:26 pm As you may be aware of already, when using HGUI on Android it also have similar issues when opening a window. Could it be that it is caused by the same bug?
No idea, have you got an MCVE for that HGUI problem?
amyren
Posts: 456
Joined: Thu May 02, 2019 11:53 am

Re: Multiple displays on android

Post by amyren »

Maybe not the smallest MCVE, but the example from https://forums.hollywood-mal.com/viewtopic.php?t=4375 will show the problem when opening that second window.

Code: Select all

@DISPLAY {Title = "HGUI test", Width = 800, Height = 600}
@INCLUDE "C:/Program Files/Hollywood/HGui-main/+Includes.hws"
@INCLUDE #INC_HGUI

;BeginDoubleBuffer()
SetFillStyle(#FILLCOLOR)

main_window = HGui.Window:new(
  { title    = "TEST",
    name     = "main",
    position = { x = #CENTER, y = #CENTER },
    size     = { w = 800, h = 600 },
    bgcolor = #RED,
    ; Let's attach a confirmation requester when the user
    ; closes the main window clicking on the close gadget.
    flags    = { AutoClose = False },
    events   = { OnClose = Function(msg)
                             Local answer = SystemRequest("ARE YOU SURE?", 
                                                          "Do you want to quit?",
                                                          "Yes|No")
                             If answer = 1 Then End
                           EndFunction
                 }
    })


Function p_displaysomething()
  SelectDisplay( 1, True)
	xpos = Rnd(750)+1
	ypos = Rnd(580)+1
	xsize = Rnd(400)+1
	ysize = Rnd(300)+1

	Box(xpos, ypos, xsize, ysize, GetRandomColor())
	SetFont(#SERIF, 24)
	TextOut(550, 20, "CLICK HERE TO TEST")
	Flip
EndFunction

Function p_HandlerFunc(msg)
	Switch(msg.Action)
	Case "OnMouseDown":
		xpos = MouseX()
		ypos = MouseY()
		If xpos > 600 And ypos < 100
			p_inputbox
		EndIf
	Case "CloseWindow":
		Wait(50)
		End
	EndSwitch
EndFunction		

Function p_inputbox()
;	EndDoubleBuffer()	
;	ClearInterval(1)
	
	If Exists("test.txt")
		OpenFile(1, "test.txt")
		While Not Eof(1) 
			string$ = string$.."\n"..ReadLine(1)
		Wend
		CloseFile(1)
		string$ = StripStr(string$)
	Else
		string$ = "Edit this"
	EndIf
	
  HGui.SetQuitOnLastWindow(False)

	myWin = HGui.Window:InputBoxNew(
		{ text = string$,
		ok = "Ok",
		cancel = { "Cancel" },
		callbackOk = p_callback,
		callbackCancel = p_callback,
		;callbackClose = p_callback,
		;--- some standard window's tags ---
		size = { w = 600, h = 300 },
		title = "The HGui Input Box...",
		name = "inputBox1"
		})

	If HGui.windowExists("inputBox1")
		myWin:Set({ title = "Textbox"}, True)
	EndIf
EndFunction 

Function p_callback(Gadget)
	If gadget.Result.Cancel
		SystemRequest("Cancelled", "You pressed Cancel!", "OK")
	Else
		SystemRequest("Text saved to file", "Saved to file:\n"..Gadget.Result.text, "OK")
		StringToFile(Gadget.Result.text, "test.txt")
	EndIf
	
  Gadget.Result.Window:free()

EndFunction

main_window:render()

;--- ADDED ---
main_window:select()
SetDisplayAttributes({ ScaleMode = #SCALEMODE_AUTO})
BeginDoubleBuffer()
;-------------
InstallEventHandler({ OnMouseDown = p_HandlerFunc, OnCloseWindow = p_HandlerFunc })

SetInterval(1, p_displaysomething, 100)

Repeat
	WaitEvent()
Forever
Post Reply