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

setSize() multiple times stop working after two calls #17217

Closed
justduy opened this issue Mar 4, 2019 · 10 comments
Closed

setSize() multiple times stop working after two calls #17217

justduy opened this issue Mar 4, 2019 · 10 comments
Labels

Comments

@justduy
Copy link

justduy commented Mar 4, 2019

  • Electron Version:
    • 4.0.1
  • Operating System:
    • Windwos 10

Expected Behavior

Setting BrowserWindow size via .setSize() sets size, in disregard of how many times called, when call through a globalShortcut.register().

Actual Behavior

Window is set successfully twice, but upon the last time it will not set window size.

To Reproduce/ Code

  globalShortcut.register("Shift+L", () => {
    isMinimized ? win.setSize(1000, 700) : win.setSize(700, 300);
    isMinimized = !isMinimized;
  });

EDIT: Not sure if helpful:

     win = new BrowserWindow({ width: 1000, height: 700, resizable: false });
     win.loadURL("someUrl"); 
     var isMinimized = false;

@welcome
Copy link

welcome bot commented Mar 4, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@MarshallOfSound
Copy link
Member

Cannot reproduce on macOS, someone on Windows will have to try verify this

@codebytere
Copy link
Member

cc @brenca could you potentially try to repro this?

@electron-triage
Copy link

Thank you for taking the time to report this issue and helping to make Electron better.

The version of Electron you reported this on has been superseded by newer releases.

If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.

I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.

Thanks in advance! Your help is appreciated.

@electron-triage electron-triage added the blocked/need-info ❌ Cannot proceed without more information label Feb 19, 2020
@electron-triage
Copy link

Thank you for your issue!

We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. I'm going to close this but don't hesitate to reach out if you have or find the answers we need, we'll be happy to reopen the issue.

@ahmadmarhaba
Copy link

I'm sorry, Ik this discussion is closed but I had this problem too and solved it by adding resizable to true then launch the set size then set resizable to false again, IDK why but the set-size function doesn't work more than 2 times unless resizable is set to true.

  • mainWindow.resizable = true;
  • mainWindow.setSize(x, y);
  • mainWindow.resizable = false;

Hope anyone who reads this understands what I mean :)

@rodrigosantosti01
Copy link

I had this problem too and solved it by adding resizable as a function:

  • mainWindow.setResizable(true);
  • mainWindow.setSize(width,height)
  • mainWindow.setResizable(false);

@Sandhya1007
Copy link

Is there a way that you can toggle between three different window sizes in electron? I am trying with setSize but its not working. I am also trying to manipulate the functionality of minimize button but that is also not working.

@sergioortegac
Copy link

I'm sorry, Ik this discussion is closed but I had this problem too and solved it by adding resizable to true then launch the set size then set resizable to false again, IDK why but the set-size function doesn't work more than 2 times unless resizable is set to true.

  • mainWindow.resizable = true;
  • mainWindow.setSize(x, y);
  • mainWindow.resizable = false;

Hope anyone who reads this understands what I mean :)

This works perfectly! Thank a lot

@shuhad
Copy link

shuhad commented Jun 16, 2022

I'm sorry, Ik this discussion is closed but I had this problem too and solved it by adding resizable to true then launch the set size then set resizable to false again, IDK why but the set-size function doesn't work more than 2 times unless resizable is set to true.

  • mainWindow.resizable = true;
  • mainWindow.setSize(x, y);
  • mainWindow.resizable = false;

Hope anyone who reads this understands what I mean :)

Still working !

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

10 participants