DocSetLoadCallbackΒΆ
DocSetLoadCallback sets a callback function. The callback function will be invoked before a document page is loaded.
-
bool = DocSetLoadCallback(hDoc, ssLoadCallback)
Return Value
Is TRUE (1), if the function was successful and otherwise FALSE (0).
Parameters
-
hDoc
Identifies the document.
-
ssLoadCallback
ssLoadCallback is a string with the callback function name. The function must have three parameters:
def callback_func(hPage, nPage, userDataObj) { return bRet; }
Example
def test_DocSetLoadCallback()
{
hDoc = DocCreate();
DocSetUserData(hDoc, [.]);
r = DocSetLoadCallback(hDoc, "_PageLoadCallback");
DocAddEmptyPages(hDoc, ["sin", "cos"])
if (_g().unit_test_cleanup) {
DocDestroy(hDoc);
}
}
def _PageLoadCallback(hPage, nPage, ctx)
{
if (nPage == 1) {
plot(x = linspace(0,2*PI*100), sin(x), hPage);
} else if (nPage == 2) {
plot(x = linspace(0,2*PI*100), cos(x), hPage);
DocAddEmptyPages(GetParent(hPage), sprintf("Page-%d", nPage+1));
} else {
h = plot(x = 1:100, rand(1,100), hPage);
DocAddEmptyPages(GetParent(hPage), sprintf("Page-%d", nPage+1));
}
}
test_DocSetLoadCallback();
History
Version | Description |
---|---|
5.20 | New. |
See also
id-1552682