FindTypeDefinition

Description

Searches for a type in one or more PowerBuilder libraries (PBLs) and provides information about its type definition. You can also get type definitions for system types.

Syntax

FindTypeDefinition ( typename {, librarylist } )

Argument

Description

typename

The name of a simple datatype, enumerated datatype, or class for which you want information. To find a type definition for a nested type, use this form:

libraryEntryName`typename

librarylist (optional)

An array of strings whose values are the fully qualified pathnames of PBLs. If you omit librarylist, FindTypeDefinition searches the library list associated with the running application.

PowerBuilder also searches its own libraries for built-in definitions, such as enumerated datatypes and system classes.


Return value

TypeDefinition. Returns an object reference with information about the definition of typename. If any arguments are null, FindTypeDefinition returns null.

Usage

The returned TypeDefinition object is a ClassDefinition, SimpleTypeDefinition, or EnumerationDefinition object. You can test the Category property to find out which one it is.

If you want to get information for a class, call FindClassDefinition instead. The arguments are the same and you are saved the step of checking that the returned object is a ClassDefinition object.

If you want to get information for a global function, call FindFunctionDefinition.

Examples

This example gets a TypeDefinition object for the grGraphType enumerated datatype. It checks the category of the type definition and, since it is an enumeration, assigns it to an EnumerationDefinition object type and saves the name in a string:

TypeDefinition td_graphtype
EnumerationDefinition ed_graphtype
string enumname
 
td_graphtype = FindTypeDefinition("grgraphtype")
IF td_graphtype.Category = EnumeratedType! THEN
      ed_graphtype = td_graphtype
      enumname = ed_graphtype.Enumeration[1].Name
END IF

This example is a function that takes a definition name as an argument. The argument is typename. It finds the named TypeDefinition object, checks its category, and assigns it to the appropriate definition object:

TypeDefinition td_def
SimpleTypeDefinition std_def
EnumerationDefinition ed_def
ClassDefinition cd_def
 
td_def = FindTypeDefinition(typename)
CHOOSE CASE td_def.Category
CASE SimpleType!
      std_def = td_def
CASE EnumeratedType!
      ed_def = td_def
CASE ClassOrStructureType!
      cd_def = td_def
END CHOOSE

This example searches the libraries in the array ls_libraries to find the class definition for w_genapp_frame:

TypeDefinition td_windef
string ls_libraries[ ]
 
ls_libraries[1] = "c:\pwrs\bizapp\windows.pbl"
ls_libraries[2] = "c:\pwrs\framewk\windows.pbl"
ls_libraries[3] = "c:\pwrs\framewk\ancestor.pbl"
 
td_windef = FindTypeDefinition("w_genapp_frame", ls_libraries)

See also

FindClassDefinition

FindFunctionDefinition

FindMatchingFunction