Answered
Public

I am playing with Zibra (very nice product) ..
I have the following code.. and I am trying to get a popup menu on a UI component. Not sure I a understand the object model. here is my code..
 
          zebra.ready(function() {      
            eval(zebra.Import(“ui”, “layout”));
            var canvas = new zebra.ui.zCanvas((8.5*72),11*72);
            
            canvas.root.properties({border : new Border()});
            var m1 = new zebra.ui.Menu();
            m1.add(“Menu Item 1″);
            m1.add(“Menu Item 2″);

            canvas.root.popup=m1;
            
            var lab = new zebra.ui.Label(“Label”);
            
            var img = new zebra.ui.ImagePan(“Image”);
            img.setImage(“me.jpg”)
            
            var m2 = new zebra.ui.Menu();
            m2.add(“Menu Item 1″);
            m2.add(“Menu Item 2″);
            m2.add(“Menu Item 3″);

            img.popup = m2;
            lab.popup=m2;            
            
            canvas.root.add(new zebra.ui.designer.ShaperPan(lab).properties({bounds: [ 30,30,100,40]}));
            canvas.root.add(new zebra.ui.designer.ShaperPan(img).properties({bounds: [ 130,130,100,50]}));
           

1 answer

Staff March 24, 2016

In your case context menu will never be shown, since “ShaperPan” is a composite component. Composite means all input events (including right mouse click that triggers context menu showing) go through any inserted into shaper panel component as if the components don’t exist. In other words label and image panel are input event transparent. To have the context menu as you need set “popup” property with the appropriate menu for shaper panel component. 

#1

Please login or Register to Submit Answer