1. #1
    Sencha User
    Join Date
    Aug 2008
    Posts
    226
    Vote Rating
    2
    TheBuzzer is on a distinguished road

      0  

    Default MenuEvent question

    MenuEvent question


    what am i doing wrong?

    Menu menu = new Menu();
    menu.add(new MenuItem("Save Order","icon-menu-save"));
    menu.add(new MenuItem("Copy Order","icon-menu-copy"));
    menu.add(new SeparatorMenuItem());
    menu.add(new MenuItem("Print Detailed Quotation","icon-menu-print"));
    menu.add(new MenuItem("Print Generic Approval","icon-menu-print"));
    menu.add(new MenuItem("Print Production Approval","icon-menu-print"));
    menu.add(new MenuItem("Print Approval","icon-menu-print"));
    menu.add(new MenuItem("Print Artwork Request","icon-menu-print"));
    menu.add(new MenuItem("Print Digitizing WorkOrder","icon-menu-print"));
    menu.add(new MenuItem("Print Sample Order","icon-menu-print"));
    menu.add(new MenuItem("Print Order","icon-menu-print"));
    menu.add(new SeparatorMenuItem());
    menu.add(new MenuItem("Close","icon-menu-close"));
    item1.setMenu(menu);

    Listener menulistener = new Listener<MenuEvent>() {

    public void handleEvent(MenuEvent be) {
    Info.display("Test","{0}",((MenuItem)be.component).getText());
    }
    };

    menu.addListener(Events.OnClick, menulistener);



    I am trying to figure out what menu item i am selecting.

  2. #2
    Sencha User
    Join Date
    Aug 2008
    Posts
    226
    Vote Rating
    2
    TheBuzzer is on a distinguished road

      0  

    Default


    never mind i figure it out

    SelectionListener menulistener = new SelectionListener<MenuEvent>() {

    public void componentSelected(MenuEvent ce) {
    Info.display("test","{0}",((MenuItem)ce.item).getText());
    }
    };

    Menu menu = new Menu();
    menu.add(new MenuItem("Save Order","icon-menu-save",menulistener));
    menu.add(new MenuItem("Copy Order","icon-menu-copy",menulistener));
    menu.add(new SeparatorMenuItem());
    menu.add(new MenuItem("Print Detailed Quotation","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Generic Approval","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Production Approval","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Approval","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Artwork Request","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Digitizing WorkOrder","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Sample Order","icon-menu-print",menulistener));
    menu.add(new MenuItem("Print Order","icon-menu-print",menulistener));
    menu.add(new SeparatorMenuItem());
    menu.add(new MenuItem("Close","icon-menu-close",menulistener));
    item1.setMenu(menu);


    seems like each menuitem got to have the listener