RESOURCE TYPE LIST

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


RESOURCE TYPE LIST (resTypes{; resFile})

ParameterTypeDescription
resTypesString ArrayList of available resource types
resFileDocRefResource file reference number, or
all open resource files, if omitted

Description

The RESOURCE TYPE LIST command populates the array resTypes with the resource types of the resources present in the resource files currently open.

If you pass a valid resource file reference number in the optional parameter resFile, only the resources from that file are listed. If you do not pass the parameter resFile, all the resources from the current open resource files are listed.

You can predeclare the array resTypes as a String or Text array before calling RESOURCE TYPE LIST. If you do not predeclare the array, the command creates resTypes as a Text array.

After the call, you can test the number of resource types found by applying the command Size of array to the array resTypes.

Examples

1. The following example populates the array atResType with the resource types of the resources present in all the resource files currently open:

   RESOURCE TYPE LIST(atResType)

2. The following example tells you if the Macintosh 4D structure file you are using contains old 4D plug-ins that will need to be updated in order to use the database on Windows:

   $vhResFile:=Open resource file(Structure file)
   RESOURCE TYPE LIST(atResType;$vhResFile)
   If (Find in array(atResType;"4DEX")>0)
        ALERT("This database contains old model Mac OS 4D plug-ins."+(Char(13)*2)+
                        "You will have to update them for using this database on Windows.")
   End if 

Note: The structure file is not the only file where old version plug-ins can be stored. The database can also include a Proc.Ext file.

3. The following project method returns the number of resources present in a resource file:

      ` Count resources project method
      ` Count resources ( Time ) -> Long
      ` Count resources ( DocRef ) -> Number of resources

   C_LONGINT($0)
   C_TIME($1)

   $0:=0
   RESOURCE TYPE LIST($atResType;$1)
   For ($vlElem;1;Size of array($atResType))
      RESOURCE LIST($atResType{$vlElem};$alResID;$atResName;$1)
      $0:=$0+Size of array($alResID)
   End for 

Once this project method is implemented in a database, you can write:

   $vhResFile:=Open resource file("")
   If (OK=1)
      ALERT("The file ""+Document+"" contains "+String(Count resources ($vhResFile))+" resource(s).")
      CLOSE RESOURCE FILE($vhResFile)
   End if 

See Also

RESOURCE LIST.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next