Page 1 of 1

Window height and splitter position return wrong

Posted: Sun Jul 20, 2025 2:48 pm
by walkero
Hello guys.
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

Re: Window height and splitter position return wrong

Posted: Thu Jul 31, 2025 3:25 pm
by airsoftsoftwair
walkero wrote: Sun Jul 20, 2025 2:48 pm 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
Have you tried taking a screenshot and checking if these values reflect the actual window dimensions and splitter position? Would be interesting to know if the values are really wrong or if RapaGUI layouts widgets differently than requested.

Re: Window height and splitter position return wrong

Posted: Sun Aug 03, 2025 1:22 pm
by walkero
But the values are the ones that RapaGui reads from the window. If I save those values at the app exit and then use them again when starting the app, the window increases its height on every start, adding the difference I pointed in the initial post. Also, the window from my example doesn't have any items that could push the window height to increase.

Re: Window height and splitter position return wrong

Posted: Sat Aug 09, 2025 10:24 pm
by airsoftsoftwair
Ok, I'll check what's going on there.