FindTypeDefinition
PowerScript function
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
|
1 |
FindTypeDefinition ( typename {, librarylist } ) |
|
Argument |
Description |
||
|---|---|---|---|
|
typename |
The name of a simple datatype, enumerated datatype, or
|
||
|
librarylist (optional) |
An array of strings whose values are the fully qualified PowerBuilder also searches its own libraries for built-in |
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:
|
1 2 3 4 5 6 7 8 9 |
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:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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:
|
1 2 3 4 5 6 7 8 |
TypeDefinition td_windef string ls_libraries[ ] ls_libraries[1] = "c:pwrsizappwindows.pbl" ls_libraries[2] = "c:pwrsframewkwindows.pbl" ls_libraries[3] = "c:pwrsframewkancestor.pbl" td_windef = FindTypeDefinition("w_genapp_frame", ls_libraries) |
See also