| rk.assign.preview.data {rkward} | R Documentation |
rk.assign.preview.data stores data associated with a specific "id". Usually this id is
provided by the <preview>-feature of a plugin.
rk.get.preview.data retrieves data previously stored with rk.assign.preview.data
rk.discard.preview.data discards data previously stored with rk.assign.preview.data.
This gets called by the <preview>-box of the plugin, automtically, when the plugin dialog is closed.
You do not generally have to call it manually. See the notes for running custom clearnup code, below.
rk.assign.preview.data(id, value = list()) rk.get.preview.data(id) rk.discard.preview.data(id)
id |
(character). Id associated with the data. Usually this will be the 'id' value of the <preview>-box. |
value. |
The value to assign. If this is a list, and contains a function named "on.delete", this function
will be run by rk.discard.preview.data (with the |
rk.assign.preview.data amd rk.get.preview.data returns the preview data (newly) associated
with the given id. rk.discard.preview.data returns NULL, invisibly.
Note: Plugins that want to produce a single plot, or open a single object via rk.edit() do not
have to call these functions, manually. See the chapter on providing previews in the Introduction to
writing plugins for RKWard.
Thomas Friedrichsmeier rkward-devel@kde.org
## To be generated in the preview() code section of a plugin
## NOT RUN
pdata <- rk.get.preview.data("SOMEID")
if (is.null (pdata)) {
outfile <- rk.get.tempfile.name(prefix="preview", extension=".txt")
pdata <- list(filename=outfile, on.delete=function (id) {
unlink(rk.get.preview.data(id)$filename)
})
rk.assign.preview.data("SOMEID", pdata)
}
try ({
cat ("This is a test", pdata$filename)
rk.edit.files(file=pdata$filename)
})
## END NOT RUN