Why Window Position is not changed when a Window was moved?
Sub Moved() Handles Moved
System.DebugLog “Top=” + self.Top.ToString + " Left = " + self.Left.ToString
End Sub
Top is always 41 and Left is always 0
Example: Linux
Example: macOS
How do you move the window? By Code? Using .Top and/or .Left?
What version of Xojo? There was a bug fixed in Xojo 2025r3 (Issue #80786)
It worked for me using Window.Bounds in that version.
Xojo 2026R1.2
Linux Ubuntu 24.04.3
Window moved interactive by mouse.
I’ve tried the following, but the values are always 0.
Public Function GetWindowPosition(w As DesktopWindow) As Point
Soft Declare Function gtk_widget_get_window Lib “libgtk-3.so.0” (widget As Ptr) As Ptr
Soft Declare Sub gdk_window_get_origin Lib “libgdk-3.so.0” (window As Ptr, x As Integer, y As Integer)// Get the underlying native widget pointer
Dim widgetPtr As Ptr = w.Handle
If widgetPtr = Nil Then Return New Point(0,0)Dim gdkWin As Ptr = gtk_widget_get_window(widgetPtr)
If gdkWin = Nil Then Return New Point(0,0)Dim x As Integer
Dim y As Integer
// Call; Xojo passes integers by reference to the C function
gdk_window_get_origin(gdkWin, x, y)Return New Point(x, y)
End Function
Sub Moved() Handles Moved
var p As Point
p = GetWindowPosition(self)System.DebugLog "MOVED Top = " + p.Y.ToString + " Left = " + p.x.ToString
End Sub