Control Alignment Mac vs Windows

Recently, control alignment between Mac and Windows seems to have gone completely off the rails. I don’t know if this is the fault of new versions of the two OSs or what, but it’s a sad state of affairs and I don’t remember it being this bad in past years.

I have a simple ContainerControl with a label, a PopUpMenu, and a Canvas. The label and PopUp both use the default System font with no size specified. If I get them all lined up nicely in the vertical axis on MacOS, they are horribly misaligned under Windows, and vice-versa. Looks like time for a whole bunch of ugly #IFTARGETs :frowning:

Xojo 2021r2.1, MacOS Monterey, Windows 10/11.

Have you an simple example, file a bug report ASAP. I feed we have a release imminent. It would be a shame to have something so wrong released. Happy to sign on, if I can reproduce.

I’ve a new crash that’s not getting much love, if you can verify:

https://tracker.xojo.com/xojoinc/xojo/-/issues/69880

It would involve some time and effort to make an example app, but here’s the result:

Mac:

Win:

1 Like

Are they just laid out in the Window editor or are you using code to move them.

Just laid out in the IDE, no control moving in code. The ContainerControl is embedded in another ContainerControl at runtime.

Moving the PopupMenu down 8 points under Windows restores alignment pretty well. FWIW, the Popup’s height is 30 rather than the default of 20, but when I make it 20 the cross-platform alignment is still off.

I worked on this at one point and found that running the same app on multiple versions of macOS and Windows resulted in different alignments in almost all cases. Apple certainly assumes that you’re using baseline constraints (which Xojo does not) and Windows… the only way I was ever able to get things right was to eyeball it.

It should be possible to create a method that you’d run on a window or container that would make th we adjustments for you, but it would have to be Xojo-version specific as they’ve made adjustments over the years.

1 Like

Thanks for the confirmation. I just tweak the Top properties now in the container’s Open event using #If Target - it works but is annoying to have to do.