Can't resize a window via code if you change the min values to allow the resize..

There are times when I need to resize a window to something smaller than what I allow the user to resize. For example, displaying a Window of configuration information where a separate prefs window is not a fit design-wise. Normally, the app is limited to the smallest size of the main window’s content, But, for the prefs, I resize to 600x500. To do this, I set the window’s minwidth and minheight to 600 and 500 respectively, call UpdateNow, and then set the new width and height. This works properly on Mac OS and Windows, but fails on Linux.

While you may not need to resize a Linux window for the same reason, if you do need to reset your min values to do this, you won’t be able to do so.

I’ve created a feedback report on this - <https://xojo.com/issue/49455>

I can resize the window. Try this code

//initial MinWidth = 600
//initial MinHeight = 400
Self.MinWidth = 400
Self.MinHeight = 200
Self.Resizeable = True

Self.Width = 500
Self.Height = 300

Hi Asis,

Can you try the project that I attached to the report?

It works (with small modification).

https://www.dropbox.com/s/epnd7gdpp33u7cx/WindowResize.xojo_binary_project.tar.gz?dl=0

Thanks for that!

Okay - so caught by the Me versus Self differences again. But … what turned me on to the problem in the first place is that in a full app, I’m calling the window by name, not as Me or Self (WAdvanced.MinWidth, WAdvanced.Width, etc).

Okay, you’ve got me stumped. What’s different between the version in my report and this one? I thought that it was Self. vs. Me, but I used Self in the original version and I call the window by name in my real app. What’s the “Small modification”?

Actually, it is a bug. I tried to manipulate the window to make it works. If you try to make the window smaller from its minimum size, it won’t works. You can see in the project file, window size > minimum size. That’s the key.

Yes - I just found that you’d set the default minwidth and minheight values to small. Kind of defeats the purpose of the report :).

Thats why its called “minimum size”
You cant set the value to lower than the minimum

But altering the size from a second window seems fine as well using a fully qualified name
I put an example on the report that does just that and works fine on my Mint 18.1 32 bit Cinnamon VM

This is not all true on linux world. The behavior depends on Window Manager. i3WM, and probably other tiling WM, completely ignore window geometry. So, I can resize any windows. But normally, you can’t resize a Gtk window to smaller than its minimum size. As long as we can modify minimum size, we can resize the window. How can we modify the minimum size when the window is already shown, that’s the issue.

I thought you want to change the minimum size so you can resize the window :D.

Lets just say that its not a normal expectation from the Xojo side of the world to expect setting the value less than the minimum should work
It wouldn’t even surprise me if the framework enforced “minimum” as “minimum” regardless of what the window manager permitted by ignoring geometry

Makes it kind of pointless to have a minimum and then say “oh but you can set it lower than that” … so its NOT the minimum

Hard to find a reason to use this feature :).

[quote=349168:@Norman Palardy]Lets just say that its not a normal expectation from the Xojo side of the world to expect setting the value less than the minimum should work
It wouldn’t even surprise me if the framework enforced “minimum” as “minimum” regardless of what the window manager permitted by ignoring geometry

Makes it kind of pointless to have a minimum and then say “oh but you can set it lower than that” … so its NOT the minimum[/quote]
Just to add data, you can do it on Mac. The window will behave until you go and attempt to resize the window, it will immediately jump to the minimum size.

Also works on Windows.

My reasoning was described in the original post - the app does not lend itself to multiple windows, so I use the same window and resize it for the preferences panel.

[quote=349168:@Norman Palardy]Lets just say that its not a normal expectation from the Xojo side of the world to expect setting the value less than the minimum should work
It wouldn’t even surprise me if the framework enforced “minimum” as “minimum” regardless of what the window manager permitted by ignoring geometry

Makes it kind of pointless to have a minimum and then say “oh but you can set it lower than that” … so its NOT the minimum[/quote]
But - you’re missing the simple fact that I reset the min values before I resize the window.

By your logic, Xcode, JavaFX/Swing, Visual Studio, and dozens of other development environment are also doing it wrong by allowing the developer to change the minimums at run time and resize the window. Also, if your logic is valid, then it should not work in Xojo on Windows or Mac OS.

It’s a bug.

Even the Xojo docs indicate that this should work: