WideStudio Logo
WideStudio
Programming Guide
WideStudio Index
Table of contents


一览



通过函数进行一览数据的显示控制

要在一览中追加项目显示数据时,使用addItem 函数。 根据addItem ,指定追加的字符串,追加的位置。省略追加位置的话,将被追加到一览的末尾。以下是一览中追加项目的范例。

#----------------------------------------------------------
#Function for the event procedure
#----------------------------------------------------------
use mpfc;

sub btnep1 {
  my ($object)= @_;
  # Delete all the items of the list.
  mpfc::WSClist_delAll($newlist_001);
  # Add an item to the last of the list.
  mpfc::WSClist_addItem($newlist_001,"item1");
  mpfc::WSClist_addItem($newlist_001,"item2");
  mpfc::WSClist_addItem($newlist_001,"item3");
  mpfc::WSClist_addItem($newlist_001,"item4");
  # Add an item to the specified position of the list.
  mpfc::WSClist_addItem($newlist_001,"item0",0);  #0 :top
  mpfc::WSClist_addItem($newlist_001,"item5",-1); #-1 :last

  # Update the modified list.
  mpfc::WSClist_updateList($newlist_001);
  return;
}
1;



通过属性进行一览数据的设定

项目数比较少的情况下,能从属性进行总的设定项目。这个情况时,首先在WS_DATA_SOURCE_NONE 中指定dataSource 属性。然后,在data 属性中用改行方式设定数据。

#----------------------------------------------------------
#Function for the event procedure
#----------------------------------------------------------
use mpfc;

sub btnep1 {
  my ($object) = @_;
  # Delete all the items of the list.
  mpfc::WSClist_delAll($newlist_001);

  # Set the items of the list by the property
  mpfc::WSCbase_setProperty($newlist_001,"dataSource",$mpfc::WS_DATA_SOURCE_NONE);
  mpfc::WSCbase_setProperty($newlist_001,"data","item0\nitem1\nitem2\nitem3\nitem4");
  return;
}
1;

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

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

#----------------------------------------------------------
#Function for the event procedure
#----------------------------------------------------------
use mpfc;

sub btnep1 {
  my ($object) = @_;
  #Delete all the list of the list
  mpfc::WSClist_delAll($newlist_001);

  # Set the items of the list by the property
  mpfc::WSCbase_setProperty($newlist_001,"dataSource",$mpfc::WS_DATA_SOURCE_NONE);
  mpfc::WSCbase_setProperty($newlist_001,"data",
     "$(WSDIR)/sys/pixmaps/bi16.xpm,item1\nitem2\nitem3");
  return;
}
1;



通过文件设定一览数据

可以通过指定文件名,从文件进行项目的总括设定。这种情况时,首先,将dataSource 属性指定为 WS_DATA_SOURCE_FILE。然后,在dataSourceName 属性中指定文件名。通过builder的属性设定,和程序的设定实现动作。下列是在程序中的设定的例子。

#----------------------------------------------------------
#Function for the event procedure
#----------------------------------------------------------
use mpfc;

sub btnep1 {
  my ($object) = @_;
  #Delete all the items of the list
  mpfc::WSClist_delAll($newlist_001);

  #Set the items from file directly
  mpfc::WSCbase_setProperty($newlist_001,"dataSource",$mpfc::WS_DATA_SOURCE_FILE);
  mpfc::WSCbase_setProperty($newlist_001,"dataSourceName","data.txt");
  return;
}
1;
# data.txt contains...
$(WSDIR)/sys/pixmaps/bi16.xpm,item1
item2
item3
item4
$(WSDIR)/sys/pixmaps/bi16.xpm,item5
item6
item7
item8



通过Instance显示一览的数据

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

#----------------------------------------------------------
#Function for the event procedure
#----------------------------------------------------------
use mpfc;

sub btnep1 {
  my ($object) = @_;
  #Delete all the items of the list
  mpfc::WSClist_delAll($newlist_001);

  #Set the items from the other instances
  mpfc::WSCbase_setProperty($newlist_001,"dataSource",$mpfc::WS_DATA_SOURCE_INSTANCE);
  mpfc::WSCbase_setProperty($newlist_001,"dataSourceName","newtext_000");
  return;
}
1;

如下面的图,从上部输入的字符串,将被显示于下部的一览中。



[通过Instance的项目设定]


Document Release 3.70 for WideStudio ver 3.70, Feb 2004


WideStudio documents index | Table of contents

Copyright(C) T. Hirabayashi, 2000-2004 Last modified: Feb 25, 2004