The onOpen Event

The onOpen event is sent to the application, when user opens the drop-down list. To defer the creation of combo items, you can use the fulfill attribute as shown below.

<combobox fulfill="onOpen">
    <comboitem label="Simple and Rich"/>    
    <comboitem label="Cool!"/>    
    <comboitem label="Ajax and RIA"/>    
</combobox>

Alternatively, you can listen to the onOpen event, and then prepare the drop-down list or change it dynamically in the listener as shown below.

<combobox id="combo" onOpen="prepare()"/>
<zscript>
    void prepare() {    
        if (event.isOpen() &amp;&amp; combo.getItemCount() == 0) {        
            combo.appendItem("Simple and Rich");            
            combo.appendItem("Cool!");            
            combo.appendItem("Ajax and RIA");            
        }        
    }    
</zscript>

The appendItem method is equivalent to create a combo item and then assign its parent to the comobox.