MenuManager in TableViewer does not work on mobile device [message #1703108] |
Tue, 28 July 2015 15:03 |
Pawel Pawel Messages: 4 Registered: July 2015 |
Junior Member |
|
|
Hi
Welcome everybody This is my first post on this forum. I really hope you can help me out with this. It is kind of strange.... Ok, so I am developing RCP application, and it has to work on mobile device with windows 8 as well (10' tablet with windows . So far so good - everything work pretty nice, except one thing that is really annoying. So I have this table, and user has possibility to use right click menu (context menu) on each row. Problem is that it does not work at all on mobile device. Right click on tablet is actually defined by pressing finger for longer period of time - then after 1 or 2 second menu should appear. Problem is that it does not at all. Funny thing is that when I connect a mouse using USB port to tablet I am able to open this menu - it works completely fine. Menu works also with finger action when I press on empty (e.g. table without any data) I noticed that this issue is related with constructor style option SWT.FULL_FULL_SELECTION that is used for creating table. When I remove it from the constructor, right click works fine but there is not any data (no record is selected), so I can not perform any context menu action. Menu is dynamic, so depending on what data is loaded, the contain of menu changes. Main problem is that method menuAboutToShow is not called at all!. The code looks like that:
Table table = new Table(parent, SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
table.setLinesVisible(true);
table.setLayout(myTableLayout);
createColumns(table, layout);
table.setHeaderVisible(true);
tableViewer = new TableViewer(table);
tableViewer.setContentProvider(myContentProvider);
tableViewer.setLabelProvider(myLabelProvider);
MenuManager contextMenu = new MenuManager();
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager mgr) {
contextMenu.add(new MyAction(action)); // THIS PLACE IS NEVER CALLED WITH RIGHT FINGER CLICK!
// dynamic filling context menu engine
}
});
Menu menu = contextMenu.createContextMenu(tableViewer.getControl());
tableViewer.getControl().setMenu(menu);
getSite().registerContextMenu(contextMenu, null);
Any idea what may be wrong ?
cheers,
Pawel
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03070 seconds