LabKit MATLAB Workbench

reference

FrameworkApp SDK API

labkit.app.CallbackContext

Provide declared App-neutral runtime capabilities.

Syntax

labkit.app.CallbackContext.appendStatus(context, message) context.appendStatus(message) context.reportError(operation, exception) context.diagnosticCheckpoint(id) context.diagnosticCount(id, count) context.alert(message, title) result = context.chooseOption(prompt, choices, Name=Value) result = context.chooseInputFile(filters, startPath) result = context.chooseInputFolder(startPath) result = context.chooseOutputFile(filters, startPath) result = context.chooseOutputFolder(startPath) result = context.saveProjectDocument(state, filepath) state = context.restoreProjectDocument(filepath) state = context.newProjectDocument() context.saveRecoveryDocument(state, filepath) paths = context.resolveSourcePaths(sources) paths = context.resolveSourcePaths(sources, ids) context.setResource(scope, id, value, cleanup) value = context.getResource(scope, id) context.removeResource(scope, id) context.clearResourceScope(scope) result = context.writeResultPackage(folder, result)

Description

CallbackContext is the sealed callback capability boundary. Each specifically named method invokes one private runtime operation. Apps receive this value only as a callback argument and never construct it. It exposes no figure, registry, component, launch request, debug object, or nested service bag.

Inputs

state
Complete App-owned state value.
message
Scalar reader-facing text.
operation
Scalar diagnostic operation text.
exception
Scalar MException.
id
Stable semantic diagnostic or resource identifier.
count
Nonnegative integer diagnostic count.
title
Scalar reader-facing dialog title.
prompt
Scalar reader-facing choice prompt.
choices
Row string or cellstr array.
Title
Reader-facing choice-dialog title. Default: "Choose an option".
DefaultChoice
Choice selected by pressing Enter. Default: the first choice.
CancelChoice
Choice returned when the dialog is dismissed. Default: the first choice.
filters
Runtime-supported file-dialog filter value.
startPath
Scalar starting file or folder path.
filepath
Scalar project or recovery source or destination path.
sources
Runtime-owned portable source collection.
ids
Optional source identifiers to resolve.
scope
"event", "interaction", "document", or "application".
value
App-neutral resource value.
cleanup
Empty or fixed callback cleanup(value).
folder
Scalar result-package folder.
result
labkit.app.result.Package value for writeResultPackage.

Outputs

state
Complete restored App state prepared for the current runtime transaction.
result
labkit.app.dialog.Choice for dialogs, project saves, and result writing.
paths
Column string array of resolved source paths.
value
Stored resource value.

Errors

labkit:app:contract:InvalidValue
A public argument is malformed.
labkit:app:runtime:InvariantFailure
A private backend operation is unavailable.

Typical Call

function state = runAnalysis(state,event,callbackContext)
arguments
state (1,1) struct
event
callbackContext (1,1) labkit.app.CallbackContext
end
callbackContext.appendStatus("Analysis started.");
end

Source

This page is generated from the MATLAB help text in +labkit/+app/CallbackContext.m.