I wanted to share some thoughts on form positioning in Lazarus and see what others think about potential improvements.
My Development Setup and The Issue:I develop on a Linux Mint Cinnamon desktop with a multi-monitor setup. My primary development display is positioned far to the left and below a much larger monitor. Because of this, my form positions often get saved with high Top values (e.g., 3200), due to the layout:
Layout:xrandr --output HDMI-0 --mode 3840x2160 --pos 0x2160 --primary
xrandr --output DP-0 --mode 1920x2160 --pos 3840x2160
xrandr --output DP-2 --mode 1920x2160 --pos 5760x2160
xrandr --output DP-4 --mode 3840x2160 --pos 1920x0
This isn't an issue during development
for me, but when I publish or share my project, the forms often appear off-screen for others. Lazarus has the "Publish Project" feature, and I wonder if it would be useful to include an option that resets all form Top and Left values to 0, ensuring visibility on most configurations.
I've experimented with different TPosition settings, such as:
poDesigned, poDefault, poScreenCenter, poDesktopCenter, poWorkAreaCenter
However, in my GTK2 projects, these settings are not always respected. I’ve also had unpredictable behavior with some of them in the past (I’ll bring that up in another post later). Even if these settings worked perfectly, they wouldn't help if someone opens my project in Lazarus and can't see the form because it’s off-screen. And because of the weird issues i often leave it in
poDesigned but because of this I often end up sharing executables with friends and they quickly let me know "HEY WE CAN'T SEE A WINDOW!"
As fore design time, experienced users know to check Top and Left or use the "Center Lost Window" feature, I’ve had issues with that in the past (especially on a Windows laptop). I believe those were addressed, but overall, form positioning still feels clunky at times.
I’d love to hear others' thoughts, but here are a couple of ideas:When opening a project, if Lazarus detects that a form is positioned outside the visible screen area, it could prompt the user with an option to center it on their active display.
An additional option in
"Publish Project" to reset form positions (Top=0, Left=0) so shared projects always start in a visible location.
This has been frustrating enough times that I felt it was worth discussing. I’d love to hear how others handle this issue or if there’s a better approach. Maybe I just need to adjust my workflow or habits,
but if a simple fix could improve Lazarus itself, I’d be happy to try implementing it myself to avoid taking up developers’ time.I’ve attached a screenshot of my display layout, which shows how my primary display is positioned well below where most people’s displays bottoms are. I don’t know if my setup is very unusual, but I doubt I’m the only one with an arrangement like this.
One other thing I keep considering should be an option is for the form to open in the center of the display where the mouse positions currently is positioned. Thunderbird works like this, it will open on whatever display has your mouse. I also implemented this myself in a couple of my programs because I had a couple friends I made programs for who kept yelling at me for not having a form in their viewable display.
Looking forward to any suggestions or thoughts!