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

Invalid Menu on Linux #77

Open
MarcKarasek opened this issue Nov 22, 2019 · 2 comments
Open

Invalid Menu on Linux #77

MarcKarasek opened this issue Nov 22, 2019 · 2 comments

Comments

@MarcKarasek
Copy link

I am trying to create a new menu for a new window.
Tried the fix from #47, did not work
If I remove the menu from the new window (not main window) then it works and I see the menu from the Main window in the new window.

error-utils.ts:14 Uncaught Error: Could not call remote method 'open'. Check that the method signature is correct. Underlying error: Invalid Menu
Underlying stack: TypeError: Invalid Menu

windowManager.templates.set('read', {
'width': 800,
'height': 600,
'position': 'topLeft',
'showDevTools': false,
'resizable': true,
'title': 'Load',
'menu': {
label: 'Read',
submenu: [
{ role: 'quit' }
]
},
'webPreferences': {
// preload: path.join(__dirname, 'preload.js'),
'nodeIntegration': true
},

readwin = windowManager.createNew('readwin', 'Read eeprom', path.join('file://', __dirname, '/read.html'), 'read')

@MarcKarasek
Copy link
Author

In the main window I am using Menu to set the menu

app.on('ready', () => {
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
})

If I remove this and try to set this from the template 'menu': it fails in the same way when opening the main window.

in tempalte.set 'main': template

let template = [{
label: '3DXTech',
submenu: [{
label: 'Load EEPROM FIle',
accelerator: 'CmdOrCtrl-L',
click() { load_eeprom() }
}, {
label: 'Save EEPROM File',
accelerator: 'CmdOrCtrl-S',
click() { save_eeprom() }
}, {
label: "Quit",
accelerator: 'Command-Q',
role: 'quit'
},
]
}, {
label: 'Debug',
submenu:[{
label: 'Toggle Development Tools',
accelerator: 'CmdOrCtrl-D',
click: (item, focusedWindow) => {
if (focusedWindow) {
focusedWindow.toggleDevTools()
}
}
}]
}]

@MarcKarasek
Copy link
Author

Got it to kinda work with Menu.buildFromTemplate(template)

But it changes both the main window and the new window..

What is the process for a new window to have it's own menu.

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

No branches or pull requests

1 participant