Traffic light buttons

macOS Sonoma, 2023r4.

I have a resizeable DesktopWindow for which in the IDE I have turned off the three traffic-light buttons. But they still appear in the app, but greyed out. If I turn off Resizeable in the IDE, then the buttons don’t appear at all. I would have expected that as one disables each button, it is disabled until all three are disabled, at which point all three cease to appear in the tilebar. This is what one sees in the IDE.

How do I keep the window resizeable, but without three disabled traffic-light buttons appearing in the titlebar of the window at runtime?

Declares… The Xojo code to do this was part of my defunct App Kit.

I give you a ptr, NSWindow.standardWindowButton( .zoom )?.hidden = true

This API can return NIL, in Swift you can use the question mark to modify the NSButton, only if the API returned a NSButton, in Xojo, you’ll have to validate the returned object wasn’t NIL, then modify its properties.

I think it might be easier for me just to enable the window Close button; it’s what the user wants anyway. Thanks though - but my Swift skills are non-existant.

Learning enough Swift to help you translate Apple docs and Swift code into Declares will massively elevate your Xojo made Mac apps in the immediate future.

It will also benefit you in the long run.

Swift isn’t that hard coming from Xojo, I managed to convert a Xojo made Mac app into Swift & SwiftUI in a week. admittedly it was a small app.

1 Like