Universitaet Bremen
FB3->Group BKB

->Main->API->Multi Mode Commands
Home
uDraw(Graph)
Download
Service & Support
Legal



Multi Mode Commands

API Multi Mode Commands

For background information about the commands described on this page, refer to the information about the multi-graph, multi-view and multi-window modes in the corresponding section of the API reference.

On this page, API commands of the multi mode category are described. This category covers all commands to work with more than one graph, view or window at a time. The commands of this category are enclosed by keyword "multi(...)". Click here to get an overview of all API commands.

multi(new_context)

This command opens a new context by operating in multi-graph mode. If uDraw(Graph) has been in the default single-graph mode and a graph was loaded before sending this command, then this graph will be automatically removed to start with an empty base window for the first context, read note about initialization. Otherwise, if uDraw(Graph) is already in multi-graph mode, an additional empty base window will appear. In both cases, the current context (which specifies the graph that will be affected by subsequent commands sent to the API) will be the new one until this is changed with command multi(set_context(...)) or until another new context is opened.

As with most commands, the answer ok is sent back to the application to confirm the execution. In the multi-graph mode (respective multi-window mode), all answers sent back to the application will have a preluding context(...) (or context_window(...)) answer which specifies the graph/context (and window) where the event happened, refer for more information. When a new context is opened, uDraw(Graph) will choose an unused context_id (and window_id) which is returned to the application in the preluding "context(...)" (or "context_window(...)") answer that will follow immediately after executing this command. This means, by opening the first context, your application program will always receive two answers. First, answer "context(...)" (or "context_window(...)") with the ID of the new context (and the new window) and afterwards "ok". Your application has to store this context ID (and window ID) to be able to apply commands to this context (and window) later. The context ID (and window ID) returned by this command will also be used later in the preluding "context(...)" (or "context_window(...)") of any answer that is sent back to the application in multi-graph (or multi-window) mode. Further, the context ID (and window ID) can be used by the application to set the current context with command multi(set_context(...)).

multi(open_context(context_id))

This command opens a new context in the same way like multi(new_context), but here the context ID is not chosen by uDraw(Graph), but specified by the application as parameter. Note: An initial underscore ("_") is not allowed for context IDs given by the application. The command returns answer ok with a preluding context(...) answer (or context_window(...) answer in multi-window mode), where the context ID is the one used in the parameter of this command (the window ID cannot be specified by the application). The current context (which specifies the graph that will be affected by subsequent commands sent to the API) will be the new one until this is changed with command multi(set_context(...)) or until another new context is opened.

multi(set_context(context_id))

This command is used in multi-graph mode to set the current context to the specified ID of a context that was previously opened with command multi(new_context) or multi(open_context(...)). Afterwards, all commands sent to the API are applied to the graph that is represented by the current context, so to manipulate different graphs, the application has to switch between the contexts by using this command. The specified context has to be still open, so it must not be closed by the user or the application before (this is propagated with a close answer). In multi-window mode, this command should not be used, use multi(set_context(context_id,window_id)) instead.

multi(set_context(context_id,window_id))

Same as multi(set_context(context_id)) above, but used in multi-window mode where it is possible to address all individual base windows of a context (called "views"). The additional window ID parameter used here is returned by the context_window(...) answer that is returned after opening the context in multi-window mode with command multi(new_context) or multi(open_context(...)) In multi-graph mode, this command must not be used, use multi(set_context(context_id)) instead.