[Gambas-user] Window position error on applying stored "geometry"

RICHARD WALKER richard.j.walker at ...247...
Sun Jun 3 02:24:42 CEST 2012


Using Gambas 3.1.1 as distributed with Mageia 2. I believe it may be
somewhat patched as it includes Mageia in the packaging wizard
distribution selection screen.

I have a small front-end program for controlling jack_capture for
which I have implemented a .conf settings file. Amongst other things,
the settings file stores the last screen location/size. The entry in
the .conf file may look like this:
[Window]
Geometry=[574,26,344,148,0]

At startup the program will actually appear at 574,52. If this
location is stored to the .conf file on exit then the next startup
will put the window at 574,78. In general the window will always
appear at a location 26 pixels below the "restored" setting.

It is not, perhaps, a coincidence that the task-bar height is 26
pixels. If I create a settings .file entry like this:
[Window]
Geometry=[574,0,344,148,0]

then the program will open with its window tucked up neatly below the
task bar. The Fmain.Top value will, of course, be 26. Changing the
task bar height to 32 will change all of the displacements from 26 to
32.

So far, so good. If I can find the panel in the Desktop.Windows list
then I can change my Settings file write procedure to incorporate the
offset thus:

Adjusted_Top = Fmain.Top - panel_height
Settings["Window/Geometry"] = [Fmain.Left, Adjusted_Top, Fmain.Width,
Fmain.Height, 0]

That should solve the problem, but I am not clear as to why it  is
necessary. Why not use absolute screen locations and completely avoid
the task bar issue?

The observant among you may be wondering why I did not use the Write
settings method. In fact I have used it but it causes a crash if the
program is closed when it is on the second monitor. I can, however,
use

Settings.Read(Fmain, "Window")

which will load the screen settings correctly, whichever screen is
indicated by the X location.

I was wondering if this is only an issue with Gambas 3 on the LXDE
desktop, but I cannot test this as I am keeping this machine
lean'n'mean; that means KDE4 and Gnome 3 are not allowed near it.

Richard




More information about the User mailing list