Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling resize on a window does nothing (or only partially works) #7504

Closed
pd-l2ork opened this issue Jun 12, 2020 · 6 comments
Closed

Disabling resize on a window does nothing (or only partially works) #7504

pd-l2ork opened this issue Jun 12, 2020 · 6 comments
Labels

Comments

@pd-l2ork
Copy link

NWJS Version : 0.46.2 and the 0.47.0beta
Operating System : Windows 10 64bit (also tested on Ubuntu 16.04)

Expected behavior

When issuing the command win.setResizable(false) the win window should cease to be resizable.

Actual behavior

On 0.46.2 nothing happens, as if the command is completely ignored. On 0.47.0beta1 the window remains resizable but the newly added space is white while the main canvas does not resize.

How to reproduce

Oopen nw.exe, and in the console do:

var gui = require('nw.gui');
var win = gui.Window.get();
win.setResizable(false);

Observe that the window resizes regardless with the small variance in behavior as noted above.

I believe the same is also the case with disabling the maximize button.

@TheJaredWilcurt
Copy link
Member

I ran nw.Window.get().setResizable(false);in 0.47.0-beta-1_32-sdk on Win 10 64 in the devTools console. It changed the window so I could no longer resize it. Running nw.Window.get().setResizable(true);allowed resizing to occur. The only thing I noticed is the title bar is noticeably shorter when resizing is disabled.

Also ran it against 0.46.2_64-sdk on Win 10 64. Same results. Though after applying it, if I moved the window (via clicking/dragging the title bar), a black border appeared around the edge of the window. If I minimized and restored the window the black border went away. This only occurs when going from a resizable window to a non-resizable. If the window was spawned with resizing disabled it does not occur.

@pd-l2ork
Copy link
Author

Thank you. I have no idea why mine did not work. Trying your one-liner works fine. Please pardon the noise.

@pd-l2ork
Copy link
Author

On a somewhat related note, is there a way to toggle maximize button on and off using a similar command?

@pd-l2ork pd-l2ork reopened this Jun 18, 2020
@pd-l2ork
Copy link
Author

@TheJaredWilcurt I have tested your example and while it does work there are two side-effects. One is positive in that the maximize window becomes inactive which is something I was hoping to implement anyhow. The other, less desirable is that the title bar gets a bit smaller and leaves visual artifacts when one hovers over the minimize and close buttons located on it. Once one minimizes the window and restores it, it looks normal with the title bar being smaller and no artifacts present. This is on Windows 10 using 0.47beta1. is there any chance that this dynamic change artifact may be fixed before the official release of 0.47?

@TheJaredWilcurt
Copy link
Member

The issue I mentioned is now posted here: #7521

@rogerwang
Copy link
Member

Fixed in #7521 . Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants