VS:ImportResToCurFileN: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{LocationMain|category=LocationVS|specific=}} | |||
__TOC__ | __TOC__ | ||
<vwDoc> | <vwDoc> | ||
Line 5: | Line 5: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<desc> | <desc> | ||
Imports the indicated resource from the specified list to the current file, if it is not already in the current file, and returns the handle to the resource. It will use a callback function to determine how to handle duplicate | Imports the indicated resource from the specified list to the current file, if it is not already in the current file, and returns the handle to the resource. It will use a callback function to determine how to handle duplicate resource.</desc> | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
Line 48: | Line 48: | ||
eImportResourceConflictResult_Rename = 2 | eImportResourceConflictResult_Rename = 2 | ||
The callback will be executed only when there are conflicts, and the return value will define how the | The callback will be executed only when there are conflicts, and the return value will define how the conflict should be resolved (much like the radio buttons in the dialog) If you want to rename, then change the var parameter with a new unique name, otherwise it will execute the callback again. | ||
</remark> | </remark> | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<sample>PROCEDURE testResCountSymFolders; | <sample> | ||
<code lang='vs'> | |||
PROCEDURE testResCountSymFolders; | |||
VAR | VAR | ||
resList : LONGINT; | resList : LONGINT; | ||
Line 71: | Line 73: | ||
alrtDialog(concat('numRes=', numRes , ' h=', h)); | alrtDialog(concat('numRes=', numRes , ' h=', h)); | ||
END; | END; | ||
RUN(testResCountSymFolders); </sample> | RUN(testResCountSymFolders); | ||
</code> | |||
</sample> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
Revision as of 02:35, 18 January 2014
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Imports the indicated resource from the specified list to the current file, if it is not already in the current file, and returns the handle to the resource. It will use a callback function to determine how to handle duplicate resource.
FUNCTION ImportResToCurFileN(
listID :LONGINT;
index :LONGINT;
callback :PROCEDURE) : HANDLE;
def vs.ImportResToCurFileN(listID, index, callback): return HANDLE
Parameters
listID LONGINT index LONGINT callback PROCEDURE
Remarks
Return values from callback determine how any conflict is handled:
eImportResourceConflictResult_DoNotImport = 0
eImportResourceConflictResult_Replace = 1
eImportResourceConflictResult_Rename = 2
The callback will be executed only when there are conflicts, and the return value will define how the conflict should be resolved (much like the radio buttons in the dialog) If you want to rename, then change the var parameter with a new unique name, otherwise it will execute the callback again.
Example
PROCEDURE testResCountSymFolders; VAR resList : LONGINT; numRes : INTEGER; h : HANDLE; FUNCTION ImportResCallback(VAR resourceName:DYNARRAY OF CHAR) : INTEGER; BEGIN AlrtDialog( resourceName ); resourceName := Concat( resourceName , '-1' ); ImportResCallback := 2; END; BEGIN { list symbol folders in curr doc } resList := BuildResourceList(16, 23, '', numRes ); h := ImportResToCurFileN( resList , 1, ImportResCallback ); alrtDialog(concat('numRes=', numRes , ' h=', h)); END; RUN(testResCountSymFolders);
Version
Availability: from Vectorworks 2014