The event is the Org.zkoss.zk.ui.event.Event class, which notifies the application what is going on. Each type of event is represented by a specific class.
to respond to an event, the application must register one or more event listeners for the event. There are 3 ways to be a component event listener.
(1) The OnXxx event listener is generally developed as an attribute of the component, as an event listener defined by the property.
<title= "Hello" border= "normal"> < label = "Say hello" onClick= "alert (&quto; Hello world!") "/></window>
(2)define the OnXxx () method in the associated build class as the event handler for the method definition.
1 <windowtitle= "Hello"Border= "normal">2 <Zscript>3 class MyButton extends button{4 Public void OnClick (MouseEvent event) {5 MessageBox.Show ("Hello world!");6 }7 }8 </Zscript>9 <ButtonID= "Hellobtn"label= "Say hello!" />Ten </window>(3) Add the Aaeventlistener () method to the component or page as the time processor for the new listener
<windowtitle= "Hello"Border= "normal"> <ButtonID= "Hellobtn"label= "Say Hi" /> <Zscript>Hellobtn.addeventlistener ("OnClick", new Org.zkoss.zk.ui.event.EventListener () {public void OnEvent (event eve NT) {MessageBox.Show ("Hello world!"); }})</Zscript></window>
ZK Frame Note 5, event