PBX_CreateNonVisualObject

PowerBuilder Native Interface

Exported methods:

PBX_CreateNonVisualObject method

Description

Creates a new instance of a nonvisual PowerBuilder extension object.

Syntax

PBX_CreateNonVisualObject(IPB_Session* pbsession, pbobject pbobj, LPCTSTR xtraName, IPBX_NonVisualObject   **obj)[Unmapped Entity: middot ]
 

Argument

Description

pbsession

This IPB session

pbobj

The name of a pbobject corresponding to the PowerBuilder extension object to be created

xtraname

The name of the PowerBuilder native class in lowercase

obj

The PowerBuilder extension object to be created

Return Values

PBXRESULT. PBX_OK for success.

Examples

In this example, the extension contains several classes. The object created depends on the string value of the class name passed in.

PBXEXPORT PBXRESULT PBXCALL PBX_CreateNonVisualObject
(
   IPB_Session*          pbsession,
   pbobject              pbobj,
   LPCTSTR               xtraName,
   IPBX_NonVisualObject  **obj
)
{
   PBXRESULT result = PBX_OK;

   string cn(className);
   if (cn.compare("class_a") == 0)
   {
      *obj = new class_a(pbobj);
   }
   else if (cn.compare("class_b") == 0)
   {
      *obj = new class_b(pbobj);
   }
   else if (cn.compare("class_c") == 0)
   {
      *obj = new class_b(pbobj);
   else
   {
      *obj = NULL;
      result = PBX_E_NO_SUCH_CLASS;
   }

   return PBX_OK;
};

Usage

You must implement this method in every PowerBuilder extension module that contains nonvisual classes. When you use the CREATE statement in PowerScript to create a new PowerBuilder extension object, the PBVM calls this method.

See Also