Wide Studio Programmer's Guide

Wide Studio Home
Up to


How to access to the gui instaces

In the event procedures, It Is the most fundamental to access to the instances. So I will explain the various kinds of accessing the instance in this section.
  • Accessing of the instance by the parameter of the event procedure
    In the event procedure which the instance has, we use the parameter of the procedure to access the instance,
  • Accesing of the instance by using the instance management
    We use the instance management to access the instance except it which the event procedure is set.
  • Accesing of the global instance directly
    You can use the global instance to access directly. it is easy to access and is good performance, but it makes the possibility of porting worse.


Accessing of the instance by the parameter of the event procedure

void event_procedure(WSCbase* object){
  //accessing the instance.
  object->setProperty(WSNlabelString,"HELLO WORLD"); 
}
the pointer: object is the instace which is the client of the event procedure that fired. the type is WSCbase*, so you can access the method of WSCbase, but you must cast the pointer by the method:cast() to access the other subclass: see the capter of casting sub class.

Accesing of the instance by using the instance management

The instance management returns the instance by name.
The instance management class The instance acquisition method
WSCbaseList WSCbaseList* WSGIappObjectList()

To access of the instace as follows:
#include "WSCbaseList.h" //to access WSGIappObjectList()
...
void event_procedure(WSCbase* object){

  //Acquisition of the instance(1)
  char* class_name = "WSCvlabel"; //Seek from the instance of WSCvlabel class
  char* obj_name   = "newvlab_001";     //the instance name is newvlab_001
  WSCbase* object = WSGIappObjectList()->getInstance(class_name,obj_name);
  object->setProperty(WSNlabelString,"HELLO WORLD"); 

  //Acquisition of the instance(2)
  char* class_name2 = "WSCbase";  //Seek from all the instances.
  char* obj_name2   = "newvlab_002";     //the instace name is newvlab_002
  WSCbase* object2 = WSGIappObjectList()->getInstance(class_name2,obj_name2);
  object2->setProperty(WSNlabelString,"HELLO WORLD"); 

The variable: obejct is the seeked instance by the specified class name and the specified instance name. If you do not want to specify the class name, you can pass "WSCbase", it seeks from all the instaces.

Accesing of the global instance directly

Make the instance globa,you can access it directly. See the capter [Setting of global instance] of Application Builder User's Guide to make it global.
#include "WSCvlabel.h" //to access WSCvlabel class
...
void event_procedure(WSCbase* object){
  //extern of the global instance
  extern WSCvlabel* newvlab_001;

  //Access the instance of WSCvlabel*: newvlab_001
  newvlab_001->setProperty(WSNlabelString,"HELLO WORLD"); 


Document Release 1.3

For Use with Wide Studio Release 1.3, Summer 2001


Wide Stuido Home | Up to

Copyright(C) T. Hirabayashi, 2000-2001 Last modified: August 20, 2001