ARRAY TO STRING 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


ARRAY TO STRING LIST (strings; resID{; resFile})

ParameterTypeDescription
stringsString arrayString or Text array
(new contents for the STR# resource)
resIDNumberResource ID number
resFileDocRefResource file reference number, or
current resource file, if omitted

Description

The ARRAY TO STRING LIST command creates or rewrites the string list ("STR#") resource whose ID is passed in resID. The contents of the resource are created from the strings passed in the array strings. The array can be a String or Text array.

If the resource cannot be added, the OK variable is set to 0 (zero).

If you pass a valid resource file reference number in resFile, the resource is added to that file. If you do not pass resFile, the resource is added to the file at the top the resource files chain (the last resource file opened).

Note: Each string of a string list resource can contain up to 255 characters.

Tip: Limit your use of string list resources to resources no more than 32K in total size, and a maximum of a few hundred strings maximum per resource.

Example

Your database relies on a given set of fonts.

In the On Exit Database Method, you write:

      ` On Exit Database Method
   If (<>vbFontsAreOK)
      FONT LIST($atFont)
      $vhResFile:=Open resource file("FontSet")
      If (OK=1)
         ARRAY TO STRING LIST($atFont;15000;$vhResFile)
         CLOSE RESOURCE FILE($vhResFile)
      End if
   End if

In the On Startup Database Method, you write:

      ` On Startup Database Method
   <>vbFontsAreOK:=False
   FONT LIST($atNewFont)
   If (Test path name("FontSet")#Is a document)
      $vhResFile:=Create resource file("FontSet")
   Else
      $vhResFile:=Open resource file("FontSet")
   End if
   If (OK=1)
      STRING LIST TO ARRAY(15000;$atOldFont;$vhResFile)
      If (OK=1)
         <>vbFontsAreOK:=True
         For($vlElem;1;Size of array($atNewFont))
            If ($atNewFont{$vlElem}#$atOldFont{$vlElem}))
               $vlElem:=MAXLONG
               <>vbFontsAreOK:=False
            End if
         End for
      Else
         <>vbFontsAreOK:=True
      End if
      CLOSE RESOURCE FILE($vhResFile)
   End if
   If(Not(<>vbFontsAreOK))
      CONFIRM("You are not using the same font set, OK?")
      If(OK=1)
         <>vbFontsAreOK:=True
      Else
         QUIT 4D
      End if
   End if

See Also

SET STRING RESOURCE, SET TEXT RESOURCE, STRING LIST TO ARRAY.

System Variables and Sets

If the resource has been written, OK is set to 1. Otherwise, it is set to 0 (zero).


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