I’m working with latest Xojo, on a Mac, making a Mac Desktop App, using Layout Manager to customize a Document Window. If I turn off the CLOSE BUTTON, run the app, I get a window with a hollowed out non-functioning, non-red close button as I should. Good! If I turn off the MINIMIZE button in the Layout manager, run it, I get a window with a hollowed out non-orange button as I should. Good! But, if I turn off the MAXIMIZE button (which I used to call Zoom button) in the Layout manager, run it, I STILL get the green Maximize button as always. Why didn’t it become hollow and non-functional? What am I missing? (THANKS!)
If you do not need the titlebar in OSX you can remove it
Window1.Open
[code]declare sub setMovableByWindowBackground _
lib “Cocoa” selector “setMovableByWindowBackground:” _
(windowRef as integer, yesNo as integer)
setMovableByWindowBackground(Window1.handle, 1)
declare sub setStyleMask lib “Cocoa.framework” selector “setStyleMask:” (id as Integer, mask as UInt32)
setStyleMask window1.Handle, 8[/code]
Thanks Axel. I DO want the window WITH Titlebar and close button (etc), just NOT the MAXIMIZE button. (Actually, to be honest, I may even want the Maximize button, now it’s just a mystery why I couldn’t simply turn it off like the other window buttons!)
Is Fullscreen also off? That enables the green button too.
Yes. Fullscreen button button is also off during these tests.
This will do it. (Three constants are available here for convenience).
Window.Open
[code]Declare Function standardWindowButton Lib “Cocoa” Selector “standardWindowButton:” (NSWindow As Ptr, windowButtonKind As Int32) As Ptr
Declare Sub setHidden Lib “Cocoa” selector “setHidden:” (obj_id as Ptr, value as Boolean)
Const NSWindowCloseButton = 0
Const NSWindowMiniaturizeButton = 1
Const NSWindowZoomButton = 2
setHidden(standardWindowButton(Ptr(Self.Handle), NSWindowZoomButton), True)[/code]
Thanks Steffan. That looks like a good “brute force” solution, as I’d call it. As my app might be Mac/Windows, I’d rather not have such a Declare. But, I like that there’s apparently nothing that can’t be done, somehow!! Heh-heh!
FWIW, I just created a brand new empty Mac Desktop project, and turned the FullScreen button off (actually was already off) and turned the Maximize button off, and yet I still got the Maximize button. I could turn off the Minimize or Close, just not the Maximize.
I had figured my program which had roots in Carbon-land might have brought forward some kind of inconsistency or something, but a brand new fully Cocoa minimum app also appears to NOT be able to turn off the Maximize button. (So, why have the choice of turning it off, if you really can’t?!) I still think I’m missing something, just can’t figure what.
The “resizable” switch must also be OFF then you will not get the Maximize button
Roger is correct. I just tried a new Xojo app and turned off Resizable, Maximize and Full-screen properties of the Window and it successfully disabled the maximize button.
Yup, that’s it…thank you everyone…for taking the time to help. Much appreciated.
Const NSWindowCloseButton = 0
Const NSWindowMiniaturizeButton = 1
Const NSWindowZoomButton = 2
setHidden(standardWindowButton(Ptr(Self.Handle), 0), True) // Const NSWindowCloseButton = 0
setHidden(standardWindowButton(Ptr(Self.Handle), 1), True) // Const NSWindowMiniaturizeButton = 0
setHidden(standardWindowButton(Ptr(Self.Handle), 2), True) // Const NSWindowZoomButton = 0
all three are hidden even thought they are set to "on’ in the “Frame” properties.
Lennox