I want to create my own context menu.
When a user clicks the BlackBerry menu button, the menu should open with only my menu items -- and not the 'Hide keyboard' and 'Switch Application' items that are included by default.
protected void makeMenu(Menu menu, int instance) {
menu.deleteAll();
// add your code here
}
Try this out
Related
I have made a navigation drawer in my app , but I have a problem that I can't open any activity related to any menu item in navigation drawer .
for example in this code I am trying to only display a toast message ,also there is no response when I click on the item from the menu.
I assume you are using menu items and I would suggest giving the same id for the navigation destination and its corresponding item.
if items id is nav_home then destionation id should also be nav_home in navigation.xml
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
appBarConfiguration = AppBarConfiguration(setOf(
R.id.nav_home, {*other navigations*}), binding.drawerLayout)
setupActionBarWithNavController(navController, appBarConfiguration)
binding.navView.setupWithNavController(navController)
when you set it like this it will automatically connect the destination to items and u dont have to set the onclick manually
Contextual Action Bar (CAB) won't disable using Crosswalk as a plugin in Cordova.
Tried everything, starting with the CSS, all the way through HTML & JavaScript, and even MainActivity.java & XWalkCordovaView.java.
I must disable the Contextual Action Bar. It cannot show up. It's messing my entire app. It needs to be gone, completely. Or at least, I settle with not seeing it in my app.
Here are some pictures:
As you see, we need to select text and show that toolbar (the black one, and disable the blue contextbar, prevent it from showing at all). It's not allowing us to use our toolbar. I mean, with Contextual Action Bar, NO WYSIWYG will work nicely.
I even have problems with the arrow select, which I'd like to disable as well, or at least change the color, or not mess up the sidenav.
So, what I tried:
MainActivity.java
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
// disable the context menu and all long clicks
super.appView.getView().setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View v)
{ return true; }
});
super.appView.getView().setLongClickable(false);
}
}
From here:
How to disable long-click which opens the Android top menu bar with copy/paste/etc. buttons in Cordova Crosswalk apps?
Pull Request: https://github.com/crosswalk-project/crosswalk/pull/3193
Now, please, I need to disable the Contextual Action Bar when I select some text. Thank you so much in advance. I've searched the whole web and nothing seems to work.
I've filled an issue on Crosswalk Project's Issues:
https://crosswalk-project.org/jira/browse/XWALK-7206
I have a plugin which adds a view. This view contains a table which contains on each row some informations. I would like to have a popup menu when I press the right mouse click.
How can I add the extension org.eclipse.ui.menus and after creating the menuContribution to see it in the view ?
In your ViewPart use this code:
MenuManager contextMenu = new MenuManager();
contextMenu.setRemoveAllWhenShown(true);
getSite().registerContextMenu(contextMenu, viewer);
Control control = viewer.getControl();
Menu menu = contextMenu.createContextMenu(control);
control.setMenu(menu);
where viewer is your TableViewer.
The context menu this creates has the same id as your view so you contribute to it with:
<menuContribution
locationURI="popup:your.view.id">
....
</menuContribution>
Hi I am trying to set focus on an item in a listview. After a user opens a file the item is added to the listview, but the issue I am having is that the listview is not setting focus on the new item that was added. I have to click the item in the listview to set focus to it. Is there a way to have the listview to highlight the newly added item right away in JavaFX 2.1 .
Assuming that the newly added item has an index of N,
Selecting it:
listView.getSelectionModel().select(N);
Focusing on it:
listView.getFocusModel().focus(N);
Scrolling to it:
listView.scrollTo(N);
You can use combinations of these and preferably in Platform.runLater().
Scroll then select:
Platform.runLater(new Runnable() {
#Override
public void run() {
listView.scrollTo(N);
listView.getSelectionModel().select(N);
}
});
I am using RCP with eclipse 3.6 and java 6.
The user needs to click with right mouse buttom then opened a menu where he makes a choice.
Which mouse event is that?
How to fill the menu with choices?.
Regards,
Haythem
Have a look at this article about RCP and eclipse 3.6. The section that I've linked to describes how to create a context menu (for a table), that will pop up when right clicking.
What I need is how to create mouseeventlistener from a menu and menuitem
Sectionstop in my code is the composite where the mouselistener will be added
Menu menu = new Menu (parent.getShell(), SWT.POP_UP);
MenuItem item = new MenuItem (menu, SWT.PUSH);
item.setText("Text 1");
MenuItem item2 = new MenuItem (menu, SWT.PUSH);
item2.setText("text 2");
sectionStop.setMenu (menu);
Since you are on your RCP, the basic question is where does the user right clicks. Is it on your view/editor or on an object that you contributed to some viewers? A better If you then you should look into contributing via the proper extension points. Either org.eclipse.ui.popupMenus or org.eclipse.ui.menus with locationURI "popup:org.eclipse.ui.popup.any"