70001903 New callback delegate passed to SelectDocument SelectDocumentBlob methods

Article 70001903
Type Wish
Product WebJS
Version 8006
Date Added 1/17/2021 12:00:00 AM
Fixed 9.9001.0.1 (1/17/2021 12:00:00 AM)
Submitted by VectorDraw Team

Summary

New user defined function passed to SelectDocument SelectDocumentBlob methods

Solution

In version 8007.0.1
SelectDocument and SelectDocumentBlob can also get a new user define function that will be called when the procedure finished

example:

vdcanvas.SelectDocument( "./Drawings/drawing.vds", false,DocumentLoadFinish);
-or- vdcanvas.SelectDocumentBlob(stringdata,filename,DocumentLoadFinish);


//the  argument contains 2 properties
//1.  e.vdcanvas : represent the component from which the SelectDocument called
//2.  e.errorcode : 0 if no error ocur and the procedure finished properly
                          !=0 an errorcode number cause the procedure not to be finished properly
        function DocumentLoadFinish(e) {
            if (e.errorcode != 0) {
               e.vdcanvas.prompt("error selecting document :" + e.errorcode);
                vdcanvas.New();
            } else {
                e.vdcanvas.promptselecting document successed");
            }
        }

Send comments on this topic.