WideStudio Logo
WideStudio
Programming Guide
WideStudio Index
Table of contents


How to access to the GUI instances

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

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

sub event_procedure {
  my ($object) = @_;
  #accessing the instance.
  $object->setProperty("labelString","HELLO WORLD"); 
}
1;

the pointer: object is the instance 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 chapter of casting sub class.

Accessing of the instance by using the instance management

The instance management returns the instance by name.

The instance management class The instance acquisition method
mpfc::WSCbaseList mpfc::WSCbaseList mpfc::WSGIappObjectList()

To access of the instance as follows:

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

sub event_procedure {
  my ($object) = @_;

  # Acquisition of the instance(1)
  $obj = mpfc::WSGIappObjectList()->getInstance(
               "WSCvlabel",       # Seek from the instance of WSCvlabel class
               "newvlab_001");    # the instance name is newvlab_001

  # to access WSGIappObjectList()
  $obj->setProperty("labelString","HELLO WORLD"); 

  # Acquisition of the instance(2)
  $obj2 = mpfc::WSGIappObjectList()->getInstance(
               "WSCbase",      # Seek from all the instances.
               "newvlab_002"); # the instance name is newvlab_002

  # to access WSGIappObjectList()
  $obj2->setProperty("labelString","HELLO WORLD"); 
}
1;

The variable: object is the sought 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 instances.

Accessing of the global instance directly

Make the instance global,you can access it directly. See the chapter [Setting of global instance] of Application Builder User's Guide to make it global.

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

sub event_procedure {
  my ($object) = @_;
  # Access the instance of WSCvlabel*: newvlab_001
  $newvlab_001->setProperty("labelString","HELLO WORLD"); 
}
1;


Document Release 3.80 for WideStudio ver 3.80, Jan 2005


WideStudio documents index | Table of contents

Copyright(C) WideStudio Development Team, 1999-2005 Last modified: Jan 05, 2005