Discuss GUI programming with the RapaGUI plugin here
ilbarbax
Posts: 114 Joined: Thu Apr 01, 2010 6:41 pm
Post
by ilbarbax » Thu Oct 22, 2020 12:19 pm
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
airsoftsoftwair
Posts: 5443 Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:
Post
by airsoftsoftwair » Wed Oct 28, 2020 10:42 pm
Works here on Windows?! What is the exact problem?
SamuraiCrow
Posts: 475 Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA
Post
by SamuraiCrow » Thu Oct 29, 2020 12:42 am
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.
I'm on registered MorphOS using FlowStudio.
airsoftsoftwair
Posts: 5443 Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:
Post
by airsoftsoftwair » Thu Oct 29, 2020 6:31 pm
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
ilbarbax
Posts: 114 Joined: Thu Apr 01, 2010 6:41 pm
Post
by ilbarbax » Thu Nov 05, 2020 9:15 am
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
airsoftsoftwair
Posts: 5443 Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:
Post
by airsoftsoftwair » Thu Nov 05, 2020 4:16 pm
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>