Jump to content
Developer Wiki and Function Reference Links ×

Creating and Filling a Resource Manager Symbol Folder.


Recommended Posts

I don't seem to be able to create a symbol folder in the resource manager and then import symbols and place them in that created folder all in the same command.  The command below creates the folder and then imports the symbols but then places them outside of the created folder.  Is there a way to do this?

As always TIA.

 

{====================================================================}

 

 PROCEDURE LoadTentSymbols;
 {$DEBUG}
 
 CONST

     kRETentSymbolFolder            = 'RE Tent Structure Symbols'; {Resource Manager Folder}
     
 VAR
     RESymbolFilePath            :STRING;
    TentSymListIDX                :LONGINT;
    TentSymListCt                :LONGINT;
    TentSymName                    :STRING;
    TentSymHdl                    :HANDLE;
    TentSymFolder                :HANDLE;  
    
    Index                        :LONGINT;
    
{=================================================================}

     FUNCTION ImportCallBack(VAR resName:DYNARRAY OF CHAR) : INTEGER;
     BEGIN
         ImportCallBack := 0;
     END;
    
{=================================================================}

BEGIN
     RESymbolFilePath := 'Raging Empire';
    TentSymListIDX := BuildResourceList(16, -13, RESymbolFilePath, TentSymListCt);
    TentSymListCt := ResourceListSize(TentSymListIDX);
    
     TentSymFolder := GetObject(kRETentSymbolFolder);
     
     IF (TentSymFolder = NIL) THEN
         BEGIN
            NameObject(kRETentSymbolFolder);
            BeginFolderN(16);
            EndFolder;
            TentSymFolder := LNewObj;
            ResetObject(TentSymFolder);
         END;
     
    FOR Index := 1 TO TentSymListCt DO
        BEGIN
            TentSymName := GetActualNameFromResourceList(TentSymListIDX,index);
            TentSymHdl := ImportResToCurFileN(TentSymListIDX, index, ImportCallBack);
            InsertSymbolInFolder(TentSymFolder,TentSymHdl);            
        END; {FOR Index := 1 TO TentSymListCt}
END;
RUN(LoadTentSymbols);
 

Link to comment

I think the reason your script isn't working is that you are using LNewObj to get a handle to your symbol folder.  The handle to the newly created symbol folder won't be returned with LNewObj since the folder is not something created on a design layer.  Instead, use TentSymFolder := GetObject(kRETentSymbolFolder) for the handle.  Then it should work (at least it worked in a simplified version of your script where I didn't also import symbols from another drawing).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...