Bring a window to the front in Linux?

Is there a way to force a particular window in an app to the front in Linux? I have a few windows and when I do a window.show for the one I want, it shows but underneath another window. I’ve messed with the order and tried a number of other things. Searching the forum it looks like others have had this issue as well, but I didn’t find a solution that will work for me as I don’t have the MBS plug-in.

If calling the Xojo Show method on it does not work then you could do declare on this method here:

https://people.gnome.org/~shaunm/girdoc/C/Gtk.Window.present.html

1 Like

I will check this out but I did solve it by checking for the OS and handling it differently if it’s Linux. I’m not sure at this point, but keeping it all within XoJo may be the safer way to go for something like this.

<https://xojo.com/issue/20137>
I have been working around a similar problem in Linux for 10 years. My current workaround just uses a timer to have the window do a Self.Show 10 msec after opening.

3 Likes

I like the timer idea! That would solve the issue regardless of the target OS. Thanks!

I have been using the timer method as well. As my VM “farm” gets larger, I do need to double-check that it consistently works across different distros. Linux is not Linux is not Linux. :slight_smile:

1 Like

That would be my concern about declaring a system call for something like this. Things might change or have issues. Keeping it in XoJo regardless of the method seems to be the safer approach.

Wow, that bug is about to be a DECADE old. The big 2 digits :partying_face: :partying_face: :partying_face:

1 Like

That is a long time. Seems like it should have been fixed by now.

1 Like

I had a similar problem on Linux and my solution was to call App.DoEvents right before calling the Window.Show method. This did the trick on Linux and does not affect Windows or Mac.

3 Likes

Another Great Solution! Simple, Easy and In XoJo. I just tried this and it works great. Thanks!

1 Like