[Gambas-bugtracker] Bug #2144: Picture displayed at wrong Position/ outside of its Container

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu May 20 12:18:31 CEST 2021


Comment #17 by Claus DIETRICH:

>The only thing I can tell you is:
>Don't move the window just after showing it.
>As the window decorations are build asynchronously, the result of an immediate move is unpredictable.
>Define the position before showing the window, or during the 'Open' event.

Defining the position before showing it worsens the result on my platforms.

>Anyway, you can't achieve what you did on Windows, because you can't know the window size with the decorations.
>There is a trick method in Qt for getting these dimensions (with a lot of warnings about it in the documentation), but I don't think there is an equivalent in GTK+.

After some further tests I found, that the definition of a Gambas-form-height in Gambas differs from Visual Basic. In Visual Basic the dimensions of the decoration frame is also unknown, but apparently included in the height value of the form. This is a remarkable difference.

Please check whether the following observation might be a trace to the bug:

When using gb.qt5 and I start my demo app, the FMain appears at a different y-position compared to gb.gtk3 or gb.qt4.
So I added a button to the FMain which shall only shift the form 100 pixels to the left:

Public Sub Button7_Click()

  Print FMain.y
  FMain.x = FMain.x - 100
  Print FMain.y


When I clicked on the button, the IDE-console showed an y-value of 401 before the shift to the left and 401 after the shift to the left - although the y-Position clearly jumped to a lower position on the screen. And even if you repeat it ... the y-position of 401 doesn't change.

However, when I used the cli-tool "xwininfo" I found that it provided an initial y-value of 401 and 424 after the shift to the left, which seems to be in line with that what I saw on the screen. 

By the way, it makes no difference whether the code for the shift to the left is located inside FMain or outside of FMain. So I don't see an impact of the asynchronous generation of the decoration yet.

More information about the Bugtracker mailing list