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


Accessing a remote instance



Accessing a remote instance

You can get a remote instance by requesting to the object management instance which exists one per a load module.

Object management class Instance retrieving class
WSCbaseList WSCbaseList* WSGIappObjectList()



The way to retrieve the object to access is as follows:

#include "WSCbaseList.h" //Access WSGIappObjectList()
#include "WSCRbase.h"    //Use the virtual remote instance class
...
void event_procedure(WSCbase* object){

  //Get WSCRbase point by the object management
  char* obj_name   = "newvlab_001";     //Remote instance named newvlab_001
  WSCRbase* rinstance = WSGIappObjectList()->getRemoteInstance(obj_name);

  //Access to the remote instance by the virtual remote instance
  rinstance->setProperty(WSNlabelString,"HELLO WORLD"); 


rinstance is the instance to access the remote instance. It requires the object name as its argument. You can access remote instances through the virtual remote instance as well as you can access usual instances(objects)

Casting a remote instance

You can use the virtual remote instance acquired through the object management by casting to original class as well as usual objects. Casting is required when you need to call methods existing in the original class. Next example is to cast WSCRlist type virtual remote instance in order to call WSClist::addItem() from WSCRbase type virtual remote instance.

#include "WSCbaseList.h" //Access to WSGIappObjectList() 
#include "WSCRlist.h"    //Use the virtual remote instance class
...
void event_procedure(WSCbase* object){

  //Getting a WSCRbase pointer by the object management
  char* obj_name   = "newlist_001";     //Remote instance named newlist_001
  WSCRbase* rinstance = WSGIappObjectList()->getRemoteInstance(obj_name);

  //Cast WSClist class remote instance to the virtual remote class 
  //  WSCRlist that corresponds to the original WSClist class
  WSCRlist* rlist = (WSCRlist*)rinstance->cast("WSCRlist");
  if (rlist == NULL){
    //Not WSCRlist class
    return;
  }

  //Call a WSClist class method
  //n through WSCRlist virtual remote instance class
  rlist->addItem("item..");


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