`
zhaozhongwei
  • 浏览: 52814 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

给control加右键菜单

阅读更多

首先让某个类实现 IMenuListener 接口,这个是向邮件事件里加action

可以采用如下实现

    public void menuAboutToShow(IMenuManager menu) {
        RemoveSelectColumnAction removeColumnAction = new RemoveSelectColumnAction(this);
        RemoveOrderByExpressionAction removeOrderByExpressionAction = new RemoveOrderByExpressionAction(this);
        menu.add(removeColumnAction);
        menu.add(removeOrderByExpressionAction);
    }

 

 

通过如下方法给control加右键功能

        MenuManager contextMenu = new MenuManager("#PopUp");
        contextMenu.add(new Separator("additions"));
        contextMenu.setRemoveAllWhenShown(true);
        contextMenu.addMenuListener(this);
        Menu menu = contextMenu.createContextMenu(getControl());
        getControl().setMenu(menu);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics