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


How to get the children of the instance

You can get the children which the instance contains with the following method.

The method Description
WSCbase* getChildInstance(char*) Returns the child by the instance name
WSClistData getChildren() Returns the children
long getAllChildren(WSClistData&) Returns recursively all of the children



How to get the child by the specified name

You can get the child by the specified name with the method: WSCbase::getChildInstance();

void event_procedure(WSCbase* object){
  //get the child which name is "newvbtn_001"
  WSCbase* child = object->getChildInstance("newvbtn_001");
  if (child != NULL){
    //the child exists.
    child->setVisible(True);
  }
}

In the example, WSCbase::getChildInstance() seeks the child which name is "newvbtn_001" from the instance: "object" recursively, and returns it if finds or returns NULL if not.

How to get the children

You can get the children which the instance contains with the method: WSCbase::getChildren();

void event_procedure(WSCbase* object){
  //get the list of the children.
  WSClistData children = object->getChildren();
  //get the number of the children.
  long num = children.getNum();
  long i;
  for(i=0; i<num; i++){
    //get each child from the list.
    WSCbase* child = (WSCbase*)children[i];
//  WSCbase* child = (WSCbase*)children.getData(i); //same as children[i].
    //access the child.
    child->setVisible(False);
  }
}

The example shows acquisition of the children which the instance contains. The method: WSCbase::getChildren() returns the list: WSClistData which contains the children of the instance. You can access each child with the method getData(i),array operator[i] of the list, and cast void* to WSCbase*.

How to get all of the children recursively

You can get all of the children recursively with the method WSCbase::getAllChildren().

void event_procedure(WSCbase* object){
  //the list for the return value of getAllChildren().
  WSClistData children;
  //get all of the children.
  object->getAllChildren(children);
  //get the number of children.
  long num = children.getNum();
  long i;
  for(i=0; i<num; i++){
    //get each child from the list.
    WSCbase* child = (WSCbase*)children[i];
    //access the child.
    child->setVisible(True);
  }
}

The example shows acquisition of all of the children. The difference from getChildren() is that it returns recursively all of the children of the instance, of the children,....

How to get all of the children of the parent application window

We call the method: WSCbase::getAllChildren() of the parent application window to get all of the children of it.

void cbop(WSCbase* object){
  //get the parent application window.
  WSCbase* win = object->getParentWindow();
  //a list for the return value.
  WSClistData children;
  //get all of the children of the application window.
  win->getAllChildren(children);
  //get the number of the children.
  long num = children.getNum();
  long i;
  for(i=0; i<num; i++){
    //get each child.
    WSCbase* child = (WSCbase*)children[i];
    //access the child.
    child->setVisible(False);
  }
}


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