I believe there is something wrong when I get the window height and splitter position on Linux. Here is an example
Although that for now I have the width and height hard-coded when the app starts, on Linux the values are quite different. The same happens with the hsplitter position. The following code prints the following on different OSes
Linux
Closing main window width: 400
Closing main window height: 137
Closing main splitter position: 168
macOS
Closing main window width: 400
Closing main window height: 100
Closing main splitter position: 185
I tried the same on Windows, and there the window height changes just a couple of pixels, but the hsplitter position doesn't change at all.
The interesting thing is that the window width, as well as the Top and Left do not have this issue, and they are always right.
Any idea why this is happening and how to bypass it?
Code: Select all
@VERSION 10,0
@OPTIONS {DPIAware = True, EnableDebug = True}
@REQUIRE "rapagui", {Link = True}
Function p_EventFunc(msg)
Switch msg.action
Case "RapaGUI"
Switch msg.attribute
Case "CloseRequest":
Switch msg.id
Case "mainWin":
DebugPrint("Closing main window width:", moai.Get("mainWin", "Width"))
DebugPrint("Closing main window height:", moai.Get("mainWin", "Height"))
DebugPrint("Closing main splitter position:", moai.Get("mainSplitter", "Position"))
End
EndSwitch
EndSwitch
EndSwitch
EndFunction
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<window id="mainWin" title="Test program" notify="CloseRequest" remember="False">
<vgroup>
<hsplitter id="mainSplitter">
<button id="btn1">Hello World!</button>
<button id="btn2">Bye World!</button>
</hsplitter>
</vgroup>
</window>
</application>
]])
InstallEventHandler({RapaGUI = p_EventFunc})
moai.Set("mainSplitter", "Position", 100)
moai.Set("mainWin", "Width", 400)
moai.Set("mainWin", "Height", 100)
Repeat
WaitEvent
Forever