Manual

Main API Special Commands

# API Special Commands

On this page, API commands of the special category are described. This category covers all commands to select or scroll to particular nodes or execute some special actions. The commands of this category are enclosed by keyword "special(...)". Click here to get an overview of all API commands.

## special(select_nodes(node_ids))

Note: This command returns the answer node_selections_labels(...) instead of the usual answer ok!

This command is used to set the current selection in a graph to the nodes specified by "node_ids". The new selection is returned by a node_selections_labels(...) answer.

## special(select_edge(edge_id))

Note: This command returns the answer edge_selection_label(...) instead of the usual answer ok!

This command is used to set the current selection in a graph to the edge specified by "edge_id". The new selection is returned by a edge_selection_label(...) answer. Note that in opposition to nodes, only one edge can be selected at a time in uDraw(Graph).

## special(focus_node(node_id))

Scrolls the visible part of the graph visualization to the node specified by "node_id". It might be a better practice to use command special(focus_node_animated(...)) which takes advantage of animation to avoid that the user is getting confused about the new location of the focus. In multi-view mode, this operation only affects the master view, and in multi-window mode, it affects the current window of the context.

## special(focus_node_animated(node_id))

Same as special(focus_node(...)), but here animation is used where the visible part of the graph visualization scrolls smoothly to the new point of focus to avoid that the user is getting confused about the new location of the focus. The speed of animation can be set with command set(animation_speed(...)). In multi-view mode, this operation only affects the master view, and in multi-window mode, it affects the current window of the context.

## special(show_url(string))

Displays a particular HTML page specified by the URL (or URL fraction) in parameter "string". The page is given to the browser application that can be specified with command set(browser(...)). A proper configuration with a working help system is required in order to use this feature, refer to the section about using the help system. When the string contains a ":/" substring, the parameter is expected to be a final URL and passed to the browser as is. Otherwise, if no substring ":/" occurs, the parameter is expected to be a relative file name in the "$UDG_HOME/docs" directory of the distribution. In the second case, uDraw(Graph) will add the URL prefix that can be specified with command set(documentation(...)) to the string of this command here before passing the URL to the HTML browser.

## special(add_language(filename))

To add additional language keys and values from the specified file to the text translation table. The parameter "string" is the file name, but without suffix "_language.menu", where "language" is the current value of environment variable $UDG_LANG. For details, please refer to the section about internationalization. Language keys are starting with "#%..." to use the internationalization feature for multilingual interfaces. By using this command, the application can participate in the uDraw(Graph) internationalization mechanism. The key/value pairs in the file are added to the text translation table, so the value of an already existing key is replaced by the new value. The language file is expected in the directory where uDraw(Graph) was started or in directory "$UDG_HOME/lib/uDrawGraph". When "string" completed by "_language.menu" is an absolute file name, then the file is loaded directly from this location.

Note: Windows® users please use "/" (slash) instead of "\" (backslash) as a directory separator.

## special(version)

Note: This command returns the answer version(...) instead of the usual answer ok!

To ask for the version number of uDraw(Graph). Returns the answer "version(string)" where the parameter is "uDraw(Graph) 3.1" in this release. For compatibility, note that minor releases (i.e. format "uDraw(Graph) x.y.z") may follow for defect repairs. This command is not available in former releases, so there you will get the answer communication_error(...). This is the only way in the API to see that your application is communicating with an version prior to uDraw(Graph) 3.1.