ZK Frame Note 5, event

Source: Internet
Author: User

    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!&quot;) "/></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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.