WideStudio/MWT Logo
WideStudio/MWT
Programming Guide
WideStudio/MWT Index
Table of contents


详细列表



通过函数控制详细列表的数据显示

在详细列表(WSCverbList)中,或者WSClist 的列表类别为[详细列表]的列表中追加项目显示数据时, 同前面介绍的情况完全一样,使用addItem 函数指定追加的字符串和追加的位置。 省略追加位置时,将被追加到列表的末尾。和列表不同的是设定各项目时使用分号进行隔开。



[详细列表显示的例子]

如下图的具有横4项的列表,将属性 WSNbarValue 设定为50,100,150。通过该属性,指定标题的分离位置。 因为将根据这个属性决定项的数,设定时请多注意。在属性 WSNtitleString 中,设定sec1,sec2,sec3,sec4。

以下是在详细列表中追加项目的范例。

#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCverbList.h>
extern WSCverbList* newlist_001;
void btnep1(WSCbase* object){
  //Delete all the items of the list.
  newlist_001->delAll();
  //Add an item to the last of the list.
  newlist_001->addItem("item1,aaa,bbb,ccc");
  newlist_001->addItem("item2,aaa,bbb,ccc");
  newlist_001->addItem("item3,aaa,bbb,ccc");
  newlist_001->addItem("item4,aaa,bbb,ccc");

  //Add an item to the specified position of the list.
  newlist_001->updateList();
}
static WSCfunctionRegister  op("btnep1",(void*)btnep1);



通过属性设定详细列表的数据

项目数比较少时,能通过属性一次性设定项目内容。 首先,将WSNdataSource 属性设定为WS_DATA_SOURCE_NONE。 然后,用改行方法在data 属性中设定数据。

#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCverbList.h>
extern WSCverbList* newlist_001;
void btnep1(WSCbase* object){
  //Delete all the items of the list.
  newlist_001->delAll();
  //Set the items of the list by the property
  newlist_001->setProperty(WSNdataSource,WS_DATA_SOURCE_NONE);
  newlist_001->setProperty(WSNdata,
     "item1,aaa,bbb,ccc\nitem2,aaa,bbb,ccc\nitem3,aaa,bbb,ccc");

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

如果如下面一样,图标文件同时也指定的话,每项目的图标也可指定。 如果设定属性 SNuseIcon为True ,指定图标时用分号来指定。 图标文件省略的话,将使用属性 WSNiconPixmap 中所指定的图标。

格式:

图标文件,项目字符串\n图标文件,项目字符串\n....

void btnep1(WSCbase* object){
  //Delete all the list of the list
  newlist_001->delAll();
  //Set the items of the list by the property
  newlist_001->setProperty(WSNdataSource,WS_DATA_SOURCE_NONE);
  newlist_001->setProperty(WSNdata,
  "$(WSDIR)/sys/pixmaps/bi16.xpm,item1,aaa,bbb,ccc\nitem2,aaa,bbb,ccc\nitem3,aaa,bbb,ccc");
}
static WSCfunctionRegister  op("btnep1",(void*)btnep1);



通过文件设定详细列表数据

可以通过指定文件一次性设定项目内容。首先,将WSNdataSource 属性指定为 WS_DATA_SOURCE_FILE。 然后,在WSNdataSourceName 属性中指定文件名。通过设定属性和程序实现动作。下列是在程序中的设定的例子。

#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCverbList.h>
extern WSCverbList* newlist_001;
void btnep1(WSCbase* object){
  //Delete all the items of the list
  newlist_001->delAll();
  //Set the items from file directly
  newlist_001->setProperty(WSNdataSource,WS_DATA_SOURCE_FILE);
  newlist_001->setProperty(WSNdataSourceName,"data.txt");
}
static WSCfunctionRegister  op("btnep1",(void*)btnep1);

//data.txt contains...
$(WSDIR)/sys/pixmaps/bi16.xpm,item1,aaa,bbb,ccc
item2,aaa,bbb,ccc
item3,aaa,bbb,ccc
item4,aaa,bbb,ccc
$(WSDIR)/sys/pixmaps/bi16.xpm,item5,aaa,bbb,ccc
item6,aaa,bbb,ccc
item7,aaa,bbb,ccc
item8,aaa,bbb,ccc



通过Instance显示详细列表的数据

通过指定Instance名,从该Instance的数据源对象属性对项目进行总括设定。 首先,将WSNdataSource 属性设定为WS_DATA_SOURCE_INSTANCE。 然后,在WSNdataSourceName属性中指定Instance名。 下列的例子中,指定了WSCtextField 的Instance(newtext_000)。 数据的形式,与文件指定的情况一样。被输入到newtext_000中的字符串在详细列表里将被显示。 通过builder的属性设定,程序的设定可以动作。 下列是在程序设定的例子。被输入区域的Instance newtext_000中所输入的字符串将作为详细列表的项目被显示。

#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSCverbList.h>
extern WSCverbList* newlist_001;
void btnep1(WSCbase* object){
  //Delete all the items of the list
  newlist_001->delAll();
  //Set the items from the other instances
  newlist_001->setProperty(WSNdataSource,WS_DATA_SOURCE_INSTANCE);
  newlist_001->setProperty(WSNdataSourceName,"newtext_000");
}
static WSCfunctionRegister  op("btnep1",(void*)btnep1);


Document Release 3.90 for WideStudio/MWT ver 3.90, Jul 2005


WideStudio/MWT documents index | Table of contents

Copyright(C) WideStudio/MWT Development Team, 1999-2005 Last modified: Jul 31, 2005