DocSetLoadCallback¶
DocSetLoadCallback setzt eine Callbackfunktion, die vor dem Laden von Dokument-Seiten aufgerufen wird.
-
bool = DocSetLoadCallback(hDoc, ssLoadCallback)
Returnwert
Ist TRUE (1), wenn die Funktion erfolgreich war und sonst FALSE (0).
Parameter
-
hDoc
hDoc ist die Zugriffsnummer des mit DocCreate erzeugten Dokuments.
-
ssLoadCallback
ssLoadCallback ist der Name einer Callback-Funktion nach folgendem Muster:
def callback_func(hPage, nPage, userDataObj) { return bRet; }
Beispiel
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 | Beschreibung |
---|---|
5.20 | Neu. |
Siehe auch
id-1552682