KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Saving a document icon into the Picture Library
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: September 13, 2002

Compatibility: 6.7.x and 6.8.x

Here is a simple project method that will read the icon of the file and save it into the Picture Library.

` Project Method: SetFileIconToLibrary
` Description: Save a document icon into the picture library
`
` $1 - Absolute path to the file

C_TEXT($1;$File)
C_LONGINT($NewID)
C_PICTURE($PicVar)
$File:=$1


ARRAY LONGINT($alPicRef;0)
ARRAY TEXT($atPicName;0)
PICTURE LIBRARY LIST($alPicRef;$atPicName)
SORT ARRAY($alPicRef;>)

$NewID:=$alPicRef{Size of array($alPicRef)}+1

GET DOCUMENT ICON($File;$PicVar;32)
SET PICTURE TO LIBRARY($PicVar;$NewID;"ICON"+String($NewID))


Here is an example of icons that have been read and saved in the Picture Library: