EnumerateSkins - cCJSkinFramework

Searches a directory path and returns an array of all skin files and skin sections

Type: Function

Return Data Type: tSkinInformation[]

Parameters: String sPath Boolean bRecursive

ParameterDescription
sPathThe directory to search for skin files. If "", the default skin path is searched
bRecursiveIf true, sub-directories are also searched


Return Value

Returns an array of tSkinInformation, representing all skins files and sections found


Syntax
Function EnumerateSkins String sPath Boolean bRecursive Returns tSkinInformation[]

Call: Get EnumerateSkins sPath bRecursive to tSkinInformationArrayVariable


Description

EnumerateSkins searches a directory path and to returns an array of all skins and skin sections. This array can be used to determine what skins are available.

The sPath parameter determines which path to search. If sPath is "", the default skin directory will be searched. The default directory is determined by calling SkinPath. Unless this function is changed, the default path is the workspace's programs directory.

The bRecursive detertmines if the search should search sub-directories.

EnumerateSkins returns an array of tSkinInformation. tSkinInformation is a struct defined as:

tSkinInformation ElementDescription
sNameThe name/description of the Skin file
sSkinFileThe file name and path of the skin file. This will be a relative path if the file is located under the default skin directory, else a qualified path.
sSkinIniThe name of the skin section within the file

The following example loads all skins from the default skin directory. It then displays all of the skins by calling AddSkin for each skin. Finally it applies the first skin as the default skin.

Procedure LoadSkinsAndApplyFirst
    Integer i iSkinsCount
    tSkinInformation[] Skins
        
    // get all skins in the default skin path
    Get EnumerateSkins of ghoSkinFramework "" True to Skins

    // Display all of the skin information
    Move (SizeOfArray(Skins)) to iSkinsCount
    For i from 0 to (iSkinsCount-1)
        Send AddSkinsToList Skins[i].sName Skins[i].sSkinFile Skins[i].sSkinIni
    Loop

    // make the first skin the current skin
    If (iSkinsCount=0) Begin // if no skin, apply an empty skin (no skin will be applied)
        Set psSkinFile to ""  
        Set psSkinIni  to ""
    End
    Else Begin
        Set psSkinFile to Skins[0].sSkinFile 
        Set psSkinIni  to Skins[0].sSkinIni
    End
    Send ApplySkin of ghoSkinFramework 

End_Procedure
 

See Also

SkinPath | ApplySkin | psSkinFile | psSkinIni