#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCtreeList.h>
extern WSCtreeList* newlist_001;
void btnep1(WSCbase* object){
static int count = 1;
  WSCstring str;
  str << "item" << count;
  newlist_001->addItem(str);

  //icon sample.. 
  if (count % 2 == 0){
    //Use specified icon instead of WSNiconPixmap property.
    //Get label from list, -1 is last one...
    WSCbase* lb = newlist_001->getLabel(-1);
    lb->setProperty(WSNlabelPixmap,"$(WSDIR)/sys/pixmaps/bi16.xpm");
  }

  // setItemValue( item pos   , WS_NDENT_LEVEL, indent_level)
  // item pos = 0,1,2,3... -1 = last one
  // indent level = 0=top,1=first child,2 = second,3...
  newlist_001->setItemValue(-1,WS_INDENT_LEVEL, (count-1) % 4 );

  // setItemValue( item pos   , WS_OPEN, flag) 
  // controling item (specified item only) for tree:open/close
  // item pos = 0,1,2,3... -1 = last one.
  // flag: 0 =close, 1 =open.
  newlist_001->setItemValue(-1,WS_OPEN,1);

  // setItemValue( item pos   , WS_ABSOLUTE_OPEN, flag) 
  // controling item (including parent item) for tree:open/close
  // item pos = 0,1,2,3... -1 = last one.
  // flag: 0 =close, 1 =open.

//    newlist_001->setItemValue(-1,WS_ABSOLUTE_OPEN,1);
  newlist_001->updateList();
  count++;

}
static WSCfunctionRegister  op("btnep1",(void*)btnep1);
