Wrong window position after reopen

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Wrong window position after reopen

Post by lazi »

Please check the following example. It has a Reopen button which makes the window close and reopen with changing the window's open attribute.
OS4 and maybe all systems based on MUI remembers the window old position, size when reopening.
On windows(tm) 10 there are two differences in that behaviour:
1. The window reopens at the center, not the previous position.
2. If the previous size was full size (with the full size gadget) after reopen the window will sticking out of the display.

Code: Select all

@REQUIRE "rapagui"
gui$=[[<?xml version="1.0" encoding="UTF-8"?>
        <application id="szamlazz">
		<window id="szamlawin" open="true" title="Számlázz" activate="false" notify="CloseRequest">
			<vgroup>
			<rectangle/>
				<colgroup columns="3">
				<rectangle/>
				<button notify="pressed" id="reopen">Reopen</button>
				<rectangle/>
				</colgroup>
			<rectangle/>
            </vgroup>
		</window>
	</application>
]]

Function p_eventfunc(msg)
		Switch msg.id
			Case "szamlawin":
				End
			Case "reopen":
				moai.set("szamlawin","Open",False)
				Wait (10)
				moai.set("szamlawin","Open",True)
		EndSwitch
EndFunction
  moai.CreateApp(gui$)
	InstallEventHandler({RapaGUI = p_EventFunc})

Repeat
	WaitEvent
Forever
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Wrong window position after reopen

Post by airsoftsoftwair »

Luckily, this is something already supported in RapaGUI 2.0. To quote from the history:

Code: Select all

- New: Added Window.Remember attribute [I]; if this is set to TRUE, the window will remember its position
  and size when the program is restarted (or when dialogs are destroyed and re-created); note that this
  is only possible for windows/dialogs that have an ID; the ID is used to memorize the window's position
  and size in order to restore it later so keep in mind that if you change the window's ID the settings
  will get lost (or they will be transferred to another window in case you re-use an ID previously used
  for a certain window for a new window); also note that this attribute defaults to TRUE on Amiga systems
  because the standard MUI behaviour is to always remember positions; on all other systems it defaults
  to FALSE
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Wrong window position after reopen

Post by lazi »

That is nice, it solves the first feature mentioned but the second problem, the full sized window reopening may be considered a bug.

I have just tried it again..
And I got it! It reopens the window with x position to the mouse x position. Just try the example and use space or enter to trigger the button.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Wrong window position after reopen

Post by airsoftsoftwair »

lazi wrote: Sat Jun 05, 2021 9:18 pm That is nice, it solves the first feature mentioned but the second problem, the full sized window reopening may be considered a bug.

I have just tried it again..
And I got it! It reopens the window with x position to the mouse x position. Just try the example and use space or enter to trigger the button.
Can't reproduce this anymore with RapaGUI 2.0 so I think it's been fixed as well.
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Re: Wrong window position after reopen

Post by lazi »

That sounds good! No more question :-)
Post Reply