Page 1 of 1

strange behaviour of sizewindow

Posted: Thu Oct 22, 2020 12:19 pm
by ilbarbax
changing the size window the display on it does not change the width consequently, while the height does.
Help please

Code: Select all

ttt$=[[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="EasyRapa">
	<window id="win"  title="EasyRapa" width="300" height="300">


		<hgroup ID="tab_l_o" title="Lay-Out">
			<rectangle id="ret_lo"/>
				<hollywood display="1" fixwidth="false" fixheight="false"/>
			<rectangle/>
		</hgroup>
	</window>
</application>
]]

@REQUIRE "RapaGUI", {Version = 1, Revision = 2}
Function p_EventFunc(msg)
;	DebugPrint(msg.action)	
	Switch msg.action
	Case "RapaGUI":
	Case "SizeWindow"
		h,w=msg.height,msg.width
		DebugPrint("zzz",w,h)
		SelectDisplay(1)
		ChangeDisplaySize(w,h,{X = 0, Y = 0})
		moai.DoMethod("ret_lo", "Redraw")
	EndSwitch

EndFunction




moai.CreateApp(ttt$)



InstallEventHandler({RapaGUI = p_EventFunc, sizewindow= p_EventFunc})
Repeat
	 WaitEvent
Forever

Re: strange behaviour of sizewindow

Posted: Wed Oct 28, 2020 10:42 pm
by airsoftsoftwair
Works here on Windows?! What is the exact problem?

Re: strange behaviour of sizewindow

Posted: Thu Oct 29, 2020 12:42 am
by SamuraiCrow
airsoftsoftwair wrote: Wed Oct 28, 2020 10:42 pm Works here on Windows?! What is the exact problem?
Resizing the window on Linux ends the script.

Edit:

Code: Select all

Function p_EventFunc(msg)
;	DebugPrint(msg.action)	
	Switch msg.action
	Case "RapaGUI":
		Switch msg.attribute
		Case "SizeWindow":
			h,w=msg.height,msg.width
			DebugPrint("zzz",w,h)
			SelectDisplay(1)
			ChangeDisplaySize(w,h,{X = 0, Y = 0})
			moai.DoMethod("ret_lo", "Redraw")
		EndSwitch
	EndSwitch
EndFunction
works.

Re: strange behaviour of sizewindow

Posted: Thu Oct 29, 2020 6:31 pm
by airsoftsoftwair
SamuraiCrow wrote: Thu Oct 29, 2020 12:42 am Resizing the window on Linux ends the script.
True, this is fixed now but I don't think that this was the original problem.

Code: Select all

- Fix [Windows/macOS/Linux]: Crash when calling Area.Redraw() on widgets that can't be drawn like widgets of Rectangle class

Re: strange behaviour of sizewindow

Posted: Thu Nov 05, 2020 9:15 am
by ilbarbax
I'm testing this on Windows.

Try to increase the window size vertically. The black box is following the new window size constantly.
Then try to increase the window size horizontally. The black box increase the size but not at the same width of the window. Two gray bands, on the side of the black box, are increasing their size step by step.

It seems there is something wrong with msg.width

Re: strange behaviour of sizewindow

Posted: Thu Nov 05, 2020 4:16 pm
by airsoftsoftwair
ilbarbax wrote: Thu Nov 05, 2020 9:15 am Then try to increase the window size horizontally. The black box increase the size but not at the same width of the window. Two gray bands, on the side of the black box, are increasing their size step by step.
Yes, that's normal behaviour because you have two Rectangle widgets next to the Hollywood widget. If you don't want the gray bands, you have to remove the Rectangle widgets, like so:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="EasyRapa">
	<window id="win"  title="EasyRapa" width="300" height="300">
		<hgroup ID="tab_l_o" title="Lay-Out">
			<hollywood display="1" fixwidth="false" fixheight="false"/>
		</hgroup>
	</window>
</application>