How to disable drawer panel in core-scaffold? - attributes

I want to disable drawer-panel in core-scaffold. I want to disable menubutton in scaffold toolbar. How can I do this?
<core-scaffold id="scaffold">
<core-header-panel id="headerpanel" navigation flex mode="seamed">
<core-toolbar id="core_toolbar">{{menuheading}}</core-toolbar>
<core-menu id="coremenu" theme="core-light-theme" selected="{{route}}" valueattr="data-route" on-core-select="{{menuItemSelected}}">
<core-item data-route="anasayfa" icon="home" label="AnaSayfa"></core-item>
<core-item data-route="kisisel" icon="account-box" label="Kişisel Bilgiler"></core-item>
<core-item data-route="adres" id="adresitem" icon="room" label="Adres İşlemleri"></core-item>
<core-item id="guzergahitem" icon="explore" label="Güzergah Görüntüle" data-route="guzergah"></core-item>
<core-item id="favoriguzergahitem" data-route="favori" icon="favorite" label="Favori Güzergah İşlemleri"></core-item>
<core-item id="cikis" icon="settings-power" label="Çıkış"></core-item>
</core-menu>
</core-header-panel>

Try this....
<core-drawer-panel id="drawerPanel" narrow="{{narrow}}" drawerWidth="{{drawerWidth}}" rightDrawer="{{rightDrawer}}" responsiveWidth="{{responsiveWidth}}" disableSwipe="{{disableSwipe}}">
disableSwipe: true,
Try this also...
mode: {value: 'seamed', reflect: true}

Related

How to close a drawer popup with a specific button/area outside it in QML?

I've created a drawer and I wish to close it by pressing the same button that triggers it. This button is outside the drawer. But QML doesn't seem to allow this as the only closepolicy (drawer property to close) options for Popups are:
Popup.NoAutoClose (where I have to click and drag the drawer to close it)
Popup.CloseOnPressOutside (anywhere outside)
Popup.CloseOnPressOutsideParent (anywhere outside) (default)
Popup.CloseOnReleaseOutside Popup.CloseOnReleaseOutsideParent
Popup.CloseOnEscape (only on escape button) (default)
Also, I don't seem to be able to click any button outside the drawer when it is visible/drawn for some reason. If that wasn't the case, I wouldn't have this issue either.
Can I make the drawer close by clicking on a specific button/area outside it?
Does anyone know the solution to this?
Thanks in advance!
Drawer inherited from Popup so we can take those advantages to control the behavior. By setting the model: false and closePolicy: Popup.NoAutoClose it is possible to control the drawer from button actions.
Window {
id: window
width: 640
height: 480
visible: true
Drawer {
id: drawer
width: 0.4 * window.width
height: window.height
closePolicy: Popup.NoAutoClose
modal: false
}
Button {
text: drawer.visible ? "close" : "open"
anchors.centerIn: parent
onClicked: {
drawer.visible = !drawer.visible
}
}
}

Remove menubar from Electron app

How do I remove this menu-bar from my electron apps:
Also it says "Hello World"(is this because I downloaded electron pre-built, and will go away once I package the application?). I didn't code these into the html, so I don't know how to get it out!-
You can use w.setMenu(null) or set frame: false (this also removes buttons for close, minimize and maximize options) on your window. See setMenu() or BrowserWindow(). Also check this thread
Electron now has win.removeMenu() (added in v5.0.0), to remove application menus instead of using win.setMenu(null).
Electron 7.1.x seems to have a bug where win.removeMenu() doesn't work. The only workaround is to use Menu.setApplicationMenu(null), however, this will disable all the menu shortcuts like F11 for toggling fullscreen etc.
In new versions of Electron, you can set autoHideMenuBar: true while creating browserWindow, pressing Alt will show the menu bar again.
const mainWindow = new BrowserWindow({
autoHideMenuBar: true,
})
Use this:
mainWindow = new BrowserWindow({width: 640, height: 360})
mainWindow.setMenuBarVisibility(false)
Reference: https://github.com/electron/electron/issues/1415
I tried mainWindow.setMenu(null), but it didn't work.
For Electron 7.1.1, you can use this:
const {app, BrowserWindow, Menu} = require('electron')
Menu.setApplicationMenu(false)
The menu can be hidden or auto-hidden (like in Slack or VS Code - you can press Alt to show/hide the menu).
Relevant methods:
---- win.setMenu(menu) - Sets the menu as the window’s menu bar,
setting it to null will remove the menu bar. (This will remove the menu completly)
mainWindow.setMenu(null)
---- win.setAutoHideMenuBar(hide) - Sets whether the window menu bar
should hide itself automatically. Once set the menu bar will only
show when users press the single Alt key.
mainWindow.setAutoHideMenuBar(true)
Source: https://github.com/Automattic/simplenote-electron/issues/293
There is also the method for making a frameless window as shown bellow:
(no close button no anything. Can be what we want (better design))
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 600, frame: false })
win.show()
https://electronjs.org/docs/api/browser-window#winremovemenu-linux-windows
doc: https://electronjs.org/docs/api/frameless-window
Edit: (new)
win.removeMenu() Linux Windows Remove the window's menu bar.
https://electronjs.org/docs/api/browser-window#winremovemenu-linux-windows
Added win.removeMenu() to remove application menus instead of using win.setMenu(null)
That is added from v5 as per:
https://github.com/electron/electron/pull/16570
https://github.com/electron/electron/pull/16657
Electron v7 bug
For Electron 7.1.1 use Menu.setApplicationMenu instead of win.removeMenu()
as per this thread:
https://github.com/electron/electron/issues/16521
And the big note is: you have to call it before creating the BrowserWindow! Or it will not work!
const {app, BrowserWindow, Menu} = require('electron')
Menu.setApplicationMenu(null);
const browserWindow = new BrowserWindow({/*...*/});
UPDATE (Setting autoHideMenuBar on BrowserWindow construction)
As by #kcpr comment! We can set the property and many on the constructor
That's available on the latest stable version of electron by now which is 8.3!
But too in old versions i checked for v1, v2, v3, v4!
It's there in all versions!
As per this link
https://github.com/electron/electron/blob/1-3-x/docs/api/browser-window.md
And for the v8.3
https://github.com/electron/electron/blob/v8.3.0/docs/api/browser-window.md#new-browserwindowoptions
The doc link
https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions
From the doc for the option:
autoHideMenuBar Boolean (optional) - Auto hide the menu bar unless the Alt key is pressed. Default is false.
Here a snippet to illustrate it:
let browserWindow = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: true // <<< here
})
When you package your app the default menu won't be there anymore, if this is bugging you during development then you can call setMenu(null) on the browser window as suggested by #TonyVincent.
As of 7.0.0, most of the above solutions no longer work.
BrowserWindow.setMenu() has been replaced by Menu.setApplicationMenu(), which now changes the menu on all windows. setMenu(), removeMenu() no longer do anything, Which by the way are still mentioned in the docs.
setAutoHideMenuBar() still works, but could be a nuisance if you planned to use Alt as a hotkey modifier. Once menu is visible you have to click away from window (loose focus) to hide menu again.
If your application has more than one window, you can't set/remove menus separately on each window. The only way to remove a menu is to use the frameless window approach. That happens to be what I want in my current application, but not a good solution in all cases.
#"electron": "^7.1.1" :
mainWindow = new browserWindow({ height: 500, width: 800});
//mainWindow.setAutoHideMenuBar(true);
mainWindow.autoHideMenuBar = true;
Working as expected without menu in browser.
These solutions has bug.
When use solutions at below, windows has delay at closing.
Menu.setApplicationMenu(null),
&&
const updateErrorWindow = new BrowserWindow({autoHideMenuBar: true});
I used solution at below. This is better for now.
const window= new BrowserWindow({...});
window.setMenuBarVisibility(false);
set autoHideMenuBar to true while creating the browserWindow
mainWindow = new BrowserWindow({
autoHideMenuBar: true,
width: 1200,
height: 800
})
Electron 12.0.6:
let mainWindow = new BrowserWindow({
autoHideMenuBar: true
});
Following the answer from this issue, you must call Menu.setApplicationMenu(null) before the window is created
2020 Update, the only bl**dy thing that worked for me:
Menu.setApplicationMenu(new Menu());
setMenu(null); is the best answer, autohidemenu will display on the start of the application
function createWindow(){
const win = new BrowserWindow({
width: 1500,
height: 800,
webPreferences:{
nodeIntergration: true
}
});
win.setMenu(null);
win.loadFile("index.html");
}
app.whenReady().then(createWindow);
Before this line at main.js:
mainWindow = new BrowserWindow({width: 800, height: 900})
mainWindow.setMenu(null) //this will r menu bar
Most of the answers here are not valid for newer versions. With the version of 9.0 or upper, Menu.setApplicationMenu(null); should work. By the way, Menu exported from electron package: const {Menu} = require('electron');
According to the official documentation # https://github.com/electron/electron/blob/v8.0.0-beta.1/docs/api/menu.md the proper way to do this now since 7.1.2 and I have tested it on 8.0 as well is to :
const { app, Menu } = require('electron')
Menu.setApplicationMenu(null)
Even if autoHideMenuBar: true, you still can toggle menu bar with Alt key.
So to hide it completely, use mainWindow.setMenu(null)

How to enable toolbars in a rendered aui dialog

I am rendering the Aui dialog by setting toolbars : false in the configuration to disable close button(X) at corner of Aui dialog.
How to enable toolbars in a rendered aui dialog. i.e I want show (X)close icon after checking certain condition.
I think simply hiding and showing the toolbar will do what you want. You can hide and show the toolbar of a modal like so:
modal.getToolbar(Y.WidgetStdMod.HEADER).hide();
modal.getToolbar(Y.WidgetStdMod.HEADER).show();
In order to satisfy your use case, you should hide the toolbar, show the modal, then when your condition is met, show the toolbar:
modal.getToolbar(Y.WidgetStdMod.HEADER).hide();
modal.show();
// Once your condition is met:
modal.getToolbar(Y.WidgetStdMod.HEADER).show();
If you need more information, check out the Toolbar API Docs.
You can also select other toolbars besides the HEADER toolbar when using Modal.getToolbar(). Check out the list of the other toolbar sections for more details.
Here's a runnable example:
YUI().use('aui-modal', function(Y) {
var modal = new Y.Modal({
bodyContent: 'Modal body',
headerContent: '<h3>Modal header</h3>',
modal: false,
render: '#modal',
width: 450,
visible: false
}).render();
modal.getToolbar(Y.WidgetStdMod.HEADER).hide();
modal.show();
Y.one('#button').on('click', function(event) {
modal.getToolbar(Y.WidgetStdMod.HEADER).enable();
modal.getToolbar(Y.WidgetStdMod.HEADER).show();
});
});
<script src="http://cdn.alloyui.com/3.0.1/aui/aui-min.js"></script>
<link href="http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css" rel="stylesheet"></link>
<div class="yui3-skin-sam">
<button id="button">Show Toolbar</button>
<div id="modal"></div>
</div>
Note: Hiding the toolbar does not disable it, so if you need to ensure that the user cannot access the toolbar, you will need to call Toolbar.disable() and you will need to disable all the inputs and buttons within the toolbar programmatically.

Not able to open a portlet in liferay dialog

I have a dialog in my portal which opens a portlet. When I click on the link and the dialog opens, the dialog shows
You do not have the roles required to access this portlet.
However, if I add the same portlet on the page, the portlet opens without any hitch, both on the page and the dialog. What am I missing here? Anybody got any idea ?
My Codes are :
#set ($profile_url = $portletURLFactory.create($request, "profile_WAR_profileportlet", $getterUtil.getLong($plid), "RENDER_PHASE"))
$profile_url.setParameter("p_p_state", "exclusive")
Profile
window,
'openDialog', //function name
function(url, popupID, wd, ht) { // parameters to the function
var A = AUI();
popupDialog = new A.Dialog({
id: popupID, // popupId passed so that it would be easy to close it through events other than the close button
centered: false, // all the different parameters function you can check in the Alloy API
draggable: true,
resizable: false,
width: wd,
stack: true,
modal: true,
height: ht,
scrollbars: true,
xy: [getWidth()/2-wd/2,10]
}
).plug(
A.Plugin.IO,
{
uri: url
}
);
popupDialog.render();
},
['aui-dialog','aui-dialog-iframe']
);
Thanks in advance for any help that anyone can provide.
I think you are missing the following configuration in the liferay-portlet.xml of the profile_WAR_profileportlet portlet:
<add-default-resource>true</add-default-resource>
This should be set to true for the portlet which is accessed inside the dialog pop-up, here is the documentation for this element.
For more information you can look at this answer the points 4 & 5 of the answer would be of help to you.
Could it be that you're setting $profile_url but actually open the dialog on $preferences_url? I guess that the preferences_url has been defined earlier - and preferences (e.g. portlet edit mode) typically require more permissions than just the regular render phase. Crosscheck by accessing this as administrator..
Add the below two lines in your portal-ext.properties file
portlet.add.default.resource.check.enabled=true
portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,103,113,145,164,166,170,33,---here append the portlet id which you want to display

YUI MenuButton: menu doesn't show when menu widget is added to button widget

Using YUI, I want to create a menu button, passing in the menu widget instance.
Result is what looks like a menu button, but the menu doesn't show.
test case: http://sandbox.kluger.com/menu_test.html
// key code section:
var D = YAHOO.util.Dom,
menu = new YAHOO.widget.Menu(D.generateId(), {lazyload: true});
menu.addItems(params.menu);
var t = new YAHOO.widget.Button({
type: "menu",
label: params.label,
menu: menu,
container: el
});
Do I need to render the menu before giving it to the Button?
If you want to see the params.menu, check the test case. The params.menu object is correct, it creates a menu when directly supplied to widget.Button. That's tested in the test case.
Any ideas appreciated.
Yes, you need to render. Add menu.render(document.body); after menu.addItems(params.menu); and it should work fine.

Resources