PBX_CreateVisualObject

PowerBuilder Native Interface

Exported methods:

PBX_CreateVisualObject method

Description

Creates a new instance of a visual PowerBuilder extension object.

Syntax

PBX_CreateVisualObject(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_CreateVisualObject
(
   IPB_Session*         pbsession,
   pbobject            pbobj,
   LPCTSTR               className,      
   IPBX_VisualObject   **obj
)
{
   PBXRESULT result = PBX_OK;

   string cn(className);
   if (cn.compare("visualext") == 0)
   {
      *obj = new CVisualExt(pbsession, pbobj);
   }
   else
   {
      *obj = NULL;
      result = PBX_FAIL;
   }
   return PBX_OK;
};

Usage

You must implement this method in every PowerBuilder extension module that contains visual classes. When you use a visual extension in a PowerBuilder application, the PBVM calls this method.

See Also