Zebra API Doc

zebra.ui.Composite Class

Interface to express intention to control children UI components event handling by making them events transparent. In the easiest way a component that needs take control on input (mouse, keyboard, etc) events has to implement the composite interface. For instance let's make a composite panel, what causes any added to the panel zebra.ui.Button component will not react on any input event:

   // declare composite panel class that inherits standard zebra
   // panel class and implements Composite interface
   var CompositePan = zebra.Class(zebra.ui.Panel, zebra.ui.Composite, []);

   // instantiate an instance
   var cp = new CompositePan(new zebra.layout.FlowLayout());

   // add button that will not react since they are events transparent
   cp.add(new zebra.ui.Button("Button 1"));
   cp.add(new zebra.ui.Button("Button 2"));

If some of the children components have to be made not event transparent you have to implement "catchInput" method as follow:

   // declare composite panel class that inherits standard zebra
   // panel class, implements Composite interface and implements
   // catchInput method to make first kid not event transparent
   var CompositePan = zebra.Class(zebra.ui.Panel, zebra.ui.Composite, [
       function catchInput(kid) {
           // make first kid not event transparent
           return this.kids.length === 0 || this.kids[0] == kid;
       }
   ]);

   ...

Item Index

Methods

Methods

catchInput

(
  • c
)
Boolean

The method is called to ask if the given children UI component has to be input events transparent

Parameters:


Return: Boolean

true if the given children component has to be input events transparent