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

version 6.0


RESOURCE LIST (resType; resIDs; resNames{; resFile})

ParameterTypeDescription
resTypeString4-character resource type
resIDsLongInt ArrayResource ID numbers for resources of this type
resNamesString ArrayResource names for resources of this type
resFileDocRefResource file reference number, or
all open resource files, if omitted

Description

The RESOURCE LIST command populates the arrays resIDs and resNames with the resource IDs and names of the resources whose type is passed in resType.

Important: You must pass a 4-character string in resType.

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 resources from the current open resource files are listed.

If you predeclare the arrays before calling RESOURCE LIST, you must predeclare resIDs as a Longint array and resNames as a String or Text array. If you do not predeclare the arrays, the command creates resIDs as a Longint array and resNames as a Text array.

After the call, you can test the number of resources found by applying the command Size of array to the array resIDs or resNames.

Examples

1. The following example populates the arrays $alResID and $atResName with the IDs and names of the string list resources present in the structure file of the database:

   If (On Windows)
      $vhStructureResFile:=Open resource file(Replace string(Structure file;".4DB";".RSR"))
   Else
      $vhStructureResFile:=Open resource file(Structure file)
   End if
   If (OK=1)
      RESOURCE LIST("STR#";$alResID;$atResName;$vhStructureResFile)
   End if

2. The following example copies the picture resources present in all currently open resource files into the Picture Library of the database:

   RESOURCE LIST("PICT";$alResID;$atResName)
   Open window(50;50;550;120;5;"Copying PICT resources...")
   For ($vlElem;1;Size of array($alResID))
      GET PICTURE RESOURCE($alResID{$vlElem};$vgPicture)
      If (OK=1)
         $vsName:=$atResName{$vlElem}
         If ($vsName="")
            $vsName:="PICT resID="+String($alResID{$vlElem})
         End if 
         ERASE WINDOW
         GOTO XY(2;1)
         MESSAGE("Adding picture ""+$vsName+"" to the DB Picture library.")
         SET PICTURE TO LIBRARY($vgPicture;$alResID{$vlElem};$vsName)
      End if 
   End for 
   CLOSE WINDOW

See Also

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