PBX_GetDescription

PowerBuilder Native Interface

Exported methods:

PBX_GetDescription method

Description

Passes a description of all the classes and methods in the PowerBuilder extension module to PowerBuilder.

Syntax

PBX_GetDescription ( )

Return Values

LPCTSTR containing the description of the module.

Examples

The following extension module contains three classes:

PBXEXPORT LPCTSTR PBXCALL PBX_GetDescription()
{
   static const TCHAR desc[] = {
      "class class_a from nonvisualobject\n"
      "function long meth1(string classpath)\n"
      "function string meth2()\n"
      "end class\n"

      "class class_b from nonvisualobject\n"
      "subroutine sbrt1()\n"
      "subroutine sbrt2()\n"
      "function long func1()\n"
      "end class\n"

      "class class_c from nonvisualobject\n"
      "end class\n"
   };

  return desc;
}

The following module contains a visual class that has two subroutines (functions that do not return values), two events that require that Windows messages be captured in the extension (onclick and ondoubleclick), and one event that maps a Windows message directly to a PowerBuilder event (testmouse). The module also contains two global functions, funca and funcb.

PBXEXPORT LPCTSTR PBXCALL PBX_GetDescription()
{
   static const TCHAR desc[] = {
      "class visualext from userobject\n"
      "event int onclick()\n"
      "event int ondoubleclick()\n"
      "subroutine setcolor(int r, int g, int b)\n"
      "subroutine settext(string txt)\n"
      "event testmouse pbm_mousemove \n"
      "end class\n"

      "globalfunctions\n"
      "function int funca(int a, int b)\n"
      "function int funcb(int a, int b)\n"
      "end globalfunctions\n"
   };

return desc;
}

Usage

You must implement this method in every PowerBuilder extension module. The method is exported from the PowerBuilder extension module and is used by PowerBuilder to display the prototype of each class, function, and event in the module.

The syntax of the description follows:

Note Multiple instances

A syntax element with an asterisk indicates that multiple instances of that element can appear in a description. For example, [Desc]* indicates that one description can contain multiple classes, global functions, and forward declarations.

Desc ::= 
             class_desc | globalfunc_desc | forward_desc | [Desc]*
class_desc ::= 
           class className from parentClass newline
             [methods_desc]* end class newline
globalfunc_desc := 
             globalfunctions newLine [func_desc]* end globalfunctions
forward_desc := 
             forward newLine [forwardtype_desc]* end forward
forwardtype_desc := 
             class className from parentClass newline
className ::= 
             a PowerBuilder token (cannot duplicate an existing group name)
parentClass ::= 
            any class inherited from NonVisualObject or UserObject
newline ::= 
            a newline character
methods_desc ::= 
            method_desc [methods_desc]*
method_desc ::= 
            func_desc | sub_desc | event_desc
func_desc ::= 
            function returnType funcName(args_desc) newline
returnType :: =
            pbType
pbType ::= 
            any PowerBuilder type | previous declared PBNI class
funcName ::= 
            a PowerBuilder token
args_desc ::= 
            None | arg_desc, [args_desc]*
arg_desc ::= 
            [ ref | readonly ] pbType argName [array_desc]
argName ::= 
            a PowerBuilder token
array_desc ::= 
             array declaration of PowerBuilder
sub_desc ::= 
            subroutine subName(args_desc) newline
event_desc ::= 
             event returnType eventName(args_desc) newline
               | event eventName pbevent_token newline
pbevent_token :: =
          string

This syntax for event_desc allows you to map a Windows message directly to a PowerBuilder event:

event eventName pbevent_token newline 

For more information, see "Event processing in visual extensions".

See Also