4D v13.4

RESOURCE LIST

Home

 
4D v13.4
RESOURCE LIST

RESOURCE LIST 


 

RESOURCE LIST ( resType ; resIDs ; resNames {; resFile} )  
Parameter Type   Description
resType  String in 4-character resource type
resIDs  Longint array in Resource ID numbers for resources of this type
resNames  String array in Resource names for resources of this type
resFile  DocRef in Resource file reference number, or all open resource files, if omitted

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.

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

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

 
PROPERTIES 

Product: 4D
Theme: Resources
Number: 500

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v6

 
SEE ALSO 

RESOURCE TYPE LIST