<klip>
   <identity>
      <title>
         API: ListControl
      </title>
   </identity>
   <locations>
      <contentsource>
         http://support.klipfolio.com/files/demo/demo.xml
      </contentsource>
      <icon>
         http://www.klipfolio.com/static/klips/klipfolio/sample_icon.png
      </icon>
      <banner>
         http://www.klipfolio.com/static/klips/klipfolio/sample_banner.png   
      </banner>
   </locations>
   <style>
      alert {
         type: item;
      }

      sender {
         itemcol: 2;
         noterow: 1;

         label: 'Sender';

         emphasis: strong;
      }


      summary {
         itemcol: 3;
         noterow: 4;

         wrap: false;

         notelabel: false;
      }

      date {
         itemcol: 4;
         noterow: 2;

         label: 'Date';
      }

      category {
         noterow: 3;

         label: 'Category';
      }


      level {
         itemcol: 1;
         noterow: 5;
         notelabel: false;
         
         type: image;
      }

      url {
         type: link;
      }
            
      id {
         key: override;
      }
   </style>
   <klipscript>
   <![CDATA[

var listControl;

function onLoad() {
 
     // Create a new tab
     var tab = Setup.addTab( "New Tab" );
 
     // Add a listcontrol usint the following parameters
     //
     //    true -- give each item in the list a checkbox
     //    true -- allow the user to select multiple items
     //
     listControl = tab.addListControl( true, true );
   
     // Add three entries
     listControl.addItem( "First Item" );
     listControl.addItem( "Second Item" );
     listControl.addItem( "Third Item" );
     
     listControl.onClick       = listControl_onClick;
     listControl.onStateChange = listControl_onStateChange;
     listControl.onDblClick    = listControl_onDblClick;
}

function listControl_onClick( index ) {
      trace( "You selected item " + index + " which is '" + this[index] + "'.\r\n" );
}

function listControl_onStateChange( index ) {
      trace( "You changed item " + index + " which is now set to '" + this.getState(index) + "'.\r\n" );
}

function listControl_onDblClick( index ) {
      trace( "You double-clicked item " + index + " which is '" + this[index] + "'.\r\n" );
}


function onRefresh()
{
	return Engines.Data.process( Prefs.contentsource );
}
  
   ]]>
   </klipscript>
</klip>
