![]() | Programming Guide | WideStudio Index Table of contents |
How to access to the GUI instances
During the event procedures, access to the instances is the most fundamental. So I will explain various ways 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,- Accessing 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.- Accessing 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
open Swig open Mwtlib let event_procedure obj = (* accessing the instance.*) obj -> setProperty ("labelString","HELLO WORLD"); () let _ = Callback.register "event_procedure" event_procedurethe pointer: obj 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.To access of the instance as follows:
The instance management class The instance acquisition method WSCbaseList WSCbaseList _WSGIappObjectList '() open Swig open Mwtlib let event_procedure obj = (* Acquisition of the instance(1) *) let instance = _WSGIappObjectList '() -> getInstance ( "WSCvlabel", (* Seek from the instance of WSCvlabel *) "newvlab_001") (* the instance name is newvlab_001 *) in instance -> setProperty ( "labelString", "HELLO WORLD"); (* Acquisition of the instance(2) *) let instance2 = _WSGIappObjectList '() -> getInstance ( "WSCbase", (* Seek from all the instances. *) "newvlab_002") (* the instance name is newvlab_002 *) in instance2 -> setProperty ( "labelString", "HELLO WORLD"); () let _ = Callback.register "event_procedure" event_procedureThe variable: obj 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.... let event_procedure obj = (* Access the instance of WSCvlabel*: newvlab_001 *) !newvlab_001 -> setProperty ("labelString","HELLO WORLD"); let _ = Callback.register "event_procedure" event_procedure
Copyright(C) WideStudio Development Team, 1999-2005 | Last modified: Jan 05, 2005 |