Maximize Window via Code


None of these seem to work. As in the window size/positon remain as they were.
I am calling this code via a MenuHandler within the Window I wish to affect.
If I click the Green Ball… it maximizes just fine… But I need to do it via code, so I can follow it with code that further analyzes the GUI status.

Oh yeah… COCOA

found this in another post

  declare sub performZoom lib "Cocoa" selector "performZoom:" ( ref as integer, sender as Ptr )
  performZoom( self.handle, nil )

And IT works…

Maximize works on Cocoa. What is the Frame property of your window? Maximize doesn’t work for Modal Dialog and others.

It is a standard “Document” window… I have changed no window attribute…
The question is why doesnt Window.Maximize work, when manual Maximize does, as does the above Declare (which I am using as a “band-aid” for now)

What’s the name of your menu item? Maximize? The try changing it to something different.

No… the word Maximize appears NOWHERE except the command itself.
No offsense… but I am not a newbie to Xojo… The menu action code is being called… the Maximize command IS being executed… it simple does nothing in my app.

I just asked, because it had troubles a long time ago with a menu item called Close, and of course the window has an event Close and a method Close. I was not able to call Close Or Self.Close in the menu handler. It compiled, but nothing happened. It was only solvable by changing the name of the menu item.
Have you tried maximizing in an empty window? If it works - it will of course -, it most be something in your code. Then add part by part more of your controls and code to the window, until it doesn’t work anymore. Then you know what the issue is.

Have you disable the MinimizeButton?

Yes… and THAT did “fix” it… except for the fact that I don’t want the MINIMIZE button to be available.

Dave, on Windows having myNamedWindow.Maximize in the menuhandler maximizes the window just fine, even with the Minimize button still enabled. For that matter, it works even if the window’s Maximize button is disabled!

You might want to file a Feedback report on this if there isn’t already one.

Yes, it’s Cocoa only (since the start of Cocoa in RB). Carbon in RB and Windows don’t show that problem.