Wide Studio Object Reference

Wide Studio Home
Up to


Class Name

WSClist

Specification of methods



setLabelHeight method

Form
void setLabelHeight(WSCushort* height)
Function
Specify the item height.
Description
Parameters
(in)WSCushort height the item height
Return value
Nothing.
Notice
Call updateList() method to redraw after this.
Samples
  newlist_000->setLabelHeight(25);
  newlist_000->updateList();



delAll method

Form
void delAll()
Function
Deletes all the items.
Description
Parameters
Nothing.
Return value
Nothing.
Notice
Call updateList() method to redraw after setting the item.
Samples
  newlist_000->delAll();
  newlist_000->addItem("item1");
  newlist_000->addItem("item2");
     :
  newlist_000->updateList();



getLabel method

Form
WSCbase* getLabel(long pos)
Function
Returns the internal instance which displays the item string in the list.
Description
You can arrange a display state of items by the instance.
Parameters
(in)long pos the poition of the item(Top= 0,,N-1)
Return value
Returns the internal instance.
Notice
The valid value of position is between top:0 and bottom:N-1 (If the number of items is N). If -1 is specified,it means the bottom item.
Samples
  newlist_000->addItem("item1");
  WSCbase* label = newlist_000->getLabel(-1); //get the last label..
  label->setProperty(WSNforeColor,"#ff0000"); //set the fore color red.



getNum method

Form
void getNum()
Function
Returns the number of items.
Description
Parameters
Nothing.
Return value
Nothing.
Notice
Nothing.
Samples
  long i;
  long num = newlist_000->getNum();
  WSCstring item;
  for(i=0; i<num; i++){
    item = newlist_000->getItem(i);
    printf("pos=%d item=%s\n",i,(char*)item);
  }



getItem method

Form
WSCstring getItem(long pos)
Function
Returns the string of the specified position.
Description
Parameters
(in)long pos the position (top:0,..,N-1 or -1:bottom)
Return value
Returns the string as WSCstring instance.
Notice
Do not receive the return value by a char* pointer, because it becomes a junc pointer by internal freeing. It requires to receive it by the WSCstring variable.
Samples
Refer to getNum().



addItem method

Form
void addItem(char* item,long pos = -1)
Function
Inserts the item into the specified position.
Description
Parameters
(in)char* the string
(in)long pos the position(top:0,..,N-1 or -1:bottom)
Return value
Nothing.
Notice
If the specified position is -1 or none, It means bottom. Please call updateList() method to redraw after setting the item.
Samples
  newlist_000->delAll();
  newlist_000->addItem("item0"); //add a last element.
  newlist_000->addItem("item1"); //add a last element.
  newlist_000->addItem("item2",0); //add a first element.
  newlist_000->addItem("item3",1); //add a second element.
  newlist_000->updateList();
Results:
  item2
  item3
  item0
  item1



replaceItem method

Form
void replaceItem(char* item,long pos)
Function
Replaces the item of the specified position.
Description
You can pass the position between top:0 and bottom: N-1, (N: the number of items). it means the bottom: N-1 item that the position is -1.
Parameters
(in)char* the string
(in)long pos the position(top:0,..,N-1 or -1:bottom)
Return value
Nothing.
Notice
Please call updateList() method to redraw after replacing the item.
Samples
  newlist_000->delAll();
  newlist_000->addItem("item1"); //add a last element.
  newlist_000->addItem("item2"); //add a last element.
  newlist_000->replaceItem("item0",-1); //replace a last elemnt to "item0".
  newlist_000->updateList();
Results:
  item1
  item2



delPos method

Form
void delPos(long pos);
Function
Deletes the item of the specified position.
Description
You can specify the position between top:0 and bottom: N-1, (N: the number of items). it means the bottom: N-1 item that the position is -1.
Parameters
(in)long pos the position(top:0,..,N-1 or -1:bottom)
Return value
Nothing.
Notice
Please call updateList() method to redraw after deleting the item.
Samples
  newlist_000->delAll(); //clear..
  newlist_000->addItem("item0"); //add a last element.
  newlist_000->addItem("item1"); //add a last element.
  newlist_000->addItem("item2"); //add a last element.
  newlist_000->delPos(1);
  newlist_000->updateList();
Results:
  item0
  item2



getSelectedPos method

Form
long getSelectedPos();
Function
Returns the position of the selected item.
Description
Returns the position of the item which is selected by the mouse pointer.
Parameters
Nothing.
Return value
Returns the position between top:0 and bottom:N-1.
Notice
Samples
  long pos = newlist_000->getSelectedPos();
  printf("selected item = %d\n",pos);



setSelectPos method

Form
void setSelectPos(long pos);
Function
Makes the item of the specified position selected.
Description
You can specify the position between top:0 and bottom: N-1, (N: the number of items). it means the bottom: N-1 item that the position is -1.
Parameters
(in)long pos the position(top:0,..,N-1 or -1:bottom)
Return value
Nothing.
Notice
Samples
  newlist_000->delAll();
  newlist_000->addItem("item0");
  newlist_000->addItem("item1");
  newlist_000->addItem("item2");
  newlist_000->setSelectedPos(1); // make the element "item1" selected.



getSelectedItem method

Form
char* getSelectedItem();
Function
Returns the string of the selected item.
Description
Parameters
Nothing.
Return value
Returns the string.
Notice
Do not delete the return value. if Sevelal items are selected,returns the last selected one. So,if you want all,use getSelectedLabels() method.
Samples
  WSCstring item;
  item = newlist_000->setSelectedItem();
  printf("selected item = %s",(char*)item);



setTopPos method

Form
void setTopPos(long pos);
Function
Scrolls the list to display the item of the specfied position most aloft.
Description
Parameters
(in)long pos the position(top:0,..,N-1 or -1:bottom)
Return value
Nothing.
Notice
Samples
  newlist_000->setTopPos(0); //scroll first line to the most top.
  newlist_000->setTopPos(10); //scroll 11th line to the most top.



setBottomPos method

Form
void setBottomPos(long pos);
Function
Scrolls the list to display the item of the specfied position most beneath.
Description
Parameters
(in)long pos the position(top:0,..,N-1 or -1:bottom)
Return value
Nothing.
Notice
  newlist_000->setBottomPos(100); //scroll 101th line to the most bottom.



updateList method

Form
void updateList();
Function
Updates the list which is changed by the methods.
Description
Parameters
Nothing.
Return value
Nothing.
Notice
Nothing.
Samples
Refer to addItem().



setLabelClass method

Form
void setLabelClass(char* class_name);
Function
Registers the class which is used to display the items.
Function
Description
The items are shown by the internal instance of the specified class. The default class is WSCvlabel.
Parameters
(in)char* class_name the class name
Return value
Nothing.
Notice
Specify the class which has the property: WSNlabelString. The list class uses WSNlabelString to set the string of the items.
Samples
  newlist_000->setLabelClass("WSCvklabel"); //specify label class name to use.



getSelectItemChanged method

Form
WSCbool getSelectItemChanged()
Function
Returns the state whether the selection of the items has changed.
Description
If the selection of the items has changed as some items become selected afresh by clicking of the mouse, the return value is True.
Parameters
Nothing.
Return value
Returns True if changed; returns False if not changed.
Notice
You need to call the method:setSlectedItemChanged(False) to clear the flag before getting a new change of the selection. then you call getSelectItemChanged() to get the change.
Samples
  WSCbool changed = newlist_000->getSelectItemChanged();
  if (changed == False){
    //the selection is not changed.
  }else{
    //the selection is changed.
  }



setSelectItemChanged method

Form
void setSelectItemChanged(WSCbool fl);
Function
Sets the value into the flag which indicates whether the selection of the items has changed.
Description
Parameters
(in)WSCbool fl True / False
Return value
Nothing.
Notice
This method is used to set the value only. Before getting the status of change by the method: getSelectItemChanged(), you need to reset the flag. Because, if the flag is True, keeps it for ever.
Samples
  newlist_000->setSelectItemChanged(True); //set the selection state.



getLabels method

Form
WSClistData* getLabels();
Function
Returns a list of the internal instances which display the items.
Description
Parameters
Return value
Returns the list of the instances.
Notice
Do not delete the return value. You can access the instances in the same way as the method:getChildren(). Cast the elements of the array [void*] into WSCbase*.
Samples
  WSClistData* labels = newlist_000->getLabels();
  long i;
  long num = labels->getNum();
  for(i=0; i<num; i++){
    WSCbase* label = (WSCbase*)labels->getData(i);
    //directry operate the internal label instance..
  }



getSelectedLabels method

Form
void getSelectedLabels(WSClistData& list);
Function
Returns the internal instances which dislpay the selected items with the specified list.
Description
Parameters
(out)WSClistData list the list which contains the return value
Return value
Nothing.
Notice
You can access the instances by casting the elements of the array [void*] into WSCbase*.
Samples
  WSClistData selected_labels;
  newlist_000->getSelectedLabels(selected_labels);
  long i;
  long num = selected_labels.getNum();
  for(i=0; i<num; i++){
    WSCbase* label = (WSCbase*)selected_labels[i];
    //directry operate the internal selected label instance..
  }



setItemVisible method

Form
long setItemVisible(long pos,WSCbool fl);
Function
Sets the visiblity of the item of the specified position.
Description
You can specify the position between top:0 and bottom: N-1, (N: the number of items). it means the bottom: N-1 item that the position is -1.
Parameters
(in)long pos the position(top:0,..,N-1 or -1:bottom)
(in)WSCbool fl True:visible,False:invisible
Return value
Returns WS_NO_ERR if it succeeds; returns the other if it fails.
Notice
Use this method when you want to make it unvisible without deleting.
Samples
  newlist_000->setItemVisible(0,False); //make the first label unvisible.



setItemValue method

Form
long setItemValue(long pos,long kind,long bal);
Function
Sets the specified value into the specified attributes of the specified item.
Description
There are folloing attributes
WS_OPEN The open and close status of the item on the tree mode. 0:close,1:open
WS_ABSOLUTE_OPEN The open and close status of the item on the tree mode. 0:close,1:open
WS_INDENT_LEVEL The indent level of the item on the tree mode. 0: most left(parent),1,2,...

Notice: WS_ABSOLUTE_OPEN effects the all parent items which relates the specified item For example,if the parent and target item is close and you specifie the open status, they becomes the open status.
Parameters
(in)long pos the position(top:0,..,N-1 or -1:bottom)
(in)long kind the attribute
(in)long val the value
Return value
Returns WS_NO_ERR if it succeeds; returns the other if it fails.
Notice
Samples
  //Tree mode..
  newlist_000->delAll();
  newlist_000->addItem("item1");
  newlist_000->addItem("item2");
  newlist_000->addItem("item3");
  newlist_000->addItem("item4");
  newlist_000->addItem("item5");
  newlist_000->setItemValue(0,WS_INDENT_LEVEL,0);
  newlist_000->setItemValue(1,WS_INDENT_LEVEL,1);
  newlist_000->setItemValue(2,WS_INDENT_LEVEL,2);
  newlist_000->setItemValue(3,WS_INDENT_LEVEL,1);
  newlist_000->setItemValue(4,WS_INDENT_LEVEL,2);
  newlist_000->setItemValue(0,WS_OPEN,1);
  newlist_000->setItemValue(1,WS_OPEN,1);
  newlist_000->setItemValue(2,WS_OPEN,1);
  newlist_000->setItemValue(3,WS_OPEN,0);
Result:
  ---item1
      +--item2
      |   +--item3
      +--item4
        ( +--item5 ) unvisible




getSortPos() method

Form
long getSortPos();
Function
Returns the number of the sort button on the detail mode.
Description
The number of the sort button is the most left one:0,1,...
Return value
Returns the number of the sort button.
Notice
Samples
  //get the id of sort button on the title bar under verbatim mode.
  long pos = newlist_000->getSortPos();



getTopPos() method

Form
long getTopPos();
Function
Returns the most top line number. on the view port of the scroll area.
Description
Returns the most top line number as 0,1,2,...
Parameters
Nothing.
Return value
The most top line number.
Notice
Samples
  //get the most top line number on the view port of the scroll area.
  long pos = newlist_000->getTopPos();



getBottomPos() method

Form
long getBottomPos();
Function
Returns the most bottom line number. on the view port of the scroll area.
Description
Returns the most bottom line number as 0,1,2,...
Parameters
Nothing.
Return value
The most bottom line number.
Notice
Samples
  //get the most bottom item.
  long pos = newlist_000->getBottomPos();



setEnableActivate() method

Form
void setEnableActivate(WSCbool fl);
Function
Set whether create the ACTIVATE event when the item is selected.
Description
It creates ACTIVATE event if Specified value is True.
Parameters
(in)WSCbool fl Whether Creats ACTIVATE event.
Return value
Nothing.
Notice
Samples
  //Creates ACTIVATE event if the item is selected.
  newlist_000->setEnableActivate(True);



onSort() method

Form
void onSort();
Function
onSort() method is executed when the sort button is pressed under the verbatim mode.
Description
Instead of the event procedure by the WSEV_SORT trigger, the WSEV_SORT event can be handled by overloading of this method. It is possible to get the button id with getSortPos() method and sort the list.
Parameters
Nothing.
Return value
Nothing.
Notice
Samples
void new_class::onSort(){
  //get the sort button id.
  long btn = getSortPos();
  //do sort by the id.

  //call the method of the parent class.
  old_class::onSort();
}



onItemSelected() method

Form
void onItemSelected();
Function
onItemSelected() method is executed when the elements is selected.
Description
Instead of the event procedure by the WSEV_ITEM_SELECTED trigger, the WSEV_ITEM_SELECTED event can be handled by overloading of this method.
Parameters
Nothing.
Return value
Nothing.
Notice
Samples
void new_class::onItemSelected(){
  //get the selected pos.
  long pos = getSelectedPos();
  //do something..

  //call the method of the parent class.
  old_class::onItemSelected();
}



onInputFixed() method

Form
void onInputFixed(WSCstring str,long pos,long column);
Function
onInputFixed( ) method is executed when keyboard input string is fixed.
Description
Instead of the event procedure by the WSEV_INPUT_FIXED trigger, the WSEV_INPUT_FIXED event can be handled by overloading of this method.
Parameters
(in)WSCstring str the input string
(in)long pos the input element number
(in)long column the column number under the verbatim mode
Return value
Nothing.
Notice
Samples
void new_class::onInputFixed(){
  //get the input string.
  WSCstring str;
  str = getInputString();

  //call the method of the parent class.
  old_class::onInputFixed();
}



cancelInput() method

Form
void cancelInput();
Function
Cancels the keyboard input string.
Description
Parameters
Nothing.
Return value
Nothing.
Notice
Samples
  //Cancels the keyboard input string.
  newlist_000->cancelInput();



getInputString() method

Form
void getInputString();
Function
Returns the keyboard input string.
Description
Parameters
Nothing.
Return value
The keyboard input string.
Notice
Samples
Refer to onInputFixed().



onKey() mentod

Form
void onKey(WSDkeyboard* keyboard,WSCbool keydown);
Function
onKey( ) is executed when the some key is input.
Description
Instead of the event procedure by the WSEV_KEY_PRESS/RELEASE trigger, the event can be handled by overloading of this method.
Parameters
(in)WSDkeyboard* keyboard the keyboard instance
(in)WSCbool keydown True = Press,False = Release
Return value
Nothing.
Notice
Samples
void new_class::onKey(WSDkeyboard* keyboard,WSCbool keydown){
  if (keydown != False){   //key pressed.
    //get key.
    long key = keyboard->getKey();
    //get keyboard input string.
    WSCstring str = keyboard->getText();
  }

  //call the method of the parent class.
  old_class::onKey(keyboard,keydown);
}


Document Release 3.20

For Use with Wide Studio Release 3.20, Spring 2003


Wide Stuido Home | Up to

Copyright(C) T. Hirabayashi, 1999-2003 Last modified: February 3, 2003