This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Using popup menus

Documents for the development of and with JVx.

--Using popup menus

Postby Development@SIB » Tue Oct 01, 2013 3:44 pm



This article is outdated - please use our new system at

https://doc.sibvisions.com




If you need a popup menu for your table on right mouse click, simple add it. A short example:

Syntax: [ Download ] [ Hide ]
UIMenu menActions = new UIMenu("Actions");
                       
UIMenuItem miInsert = new UIMenuItem("Insert");
UIMenuItem miDelete = new UIMenuItem("Delete");
                       
menActions.add(miInsert);
menActions.add(miDelete);              
       
UIMenuItem  miSearch = new UIMenuItem("Show");
miSearch.setImage(UIImage.getImage(UIImage.SEARCH_SMALL));

UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.add(menActions);
popupMenu.addSeparator();
popupMenu.add(miSearch);

You should add a mouse event for your component, to show the popup (you also could add the event to an image or a panel):

Syntax: [ Download ] [ Hide ]
tblMaster.eventMousePressed().addListener(this, "doShowPopup");
 

and the listener method:

Syntax: [ Download ] [ Hide ]
public void doShowPopup(UIMouseEvent pEvent)
{
    if (pEvent.isPopupTrigger() )
    {  
        popupMenu.show(pEvent.getSource(), pEvent.getX(), pEvent.getY());
    }
}
User avatar
Development@SIB
 
Posts: 325
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation