MenuManager in TableViewer does not work on mobile device (tablet with Win 8) [message #1703147] |
Tue, 28 July 2015 17:12  |
Eclipse User |
|
|
|
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/SWT application, and it has to work on mobile device with windows 8 as well (10' tablet with windows Cool. 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 Smile - 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);
Additional info: this tap-hold functionally is standard equivalent for right click on tablet device with Windows. I did not do any additional implementation for that. I think it should just work. I have several tables in my application and in all of those this problem appears. Any idea what may be wrong ?
cheers,
Pawel
[Updated on: Tue, 28 July 2015 17:13] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.70010 seconds