Manual

Main API Window Commands

# API Window Commands

On this page, API commands of the window category are described. This category covers all commands to manipulate uDraw(Graph) base windows. In multi-view mode, when one graph is shown in many base windows, some of the commands of this category are only applied to the master view which is the oldest view. Use the multi-window mode in order to manipulate any view/base window of a context. The commands of this category are enclosed by keyword "window(...)". Click here to get an overview of all API commands.

## window(title(string))

Sets the title of the base window to "string". A permanent prefix "uDraw(Graph) 3.1 - " is used in the title which cannot be changed. In multi-view and multi-window mode, this operation affects all views of the current context.

## window(show_message(lang_string))

Displays a message "string" in the left footer area of the base window. This command should be used to show temporary information, for example to inform the used about success of an operation. For permanent messages, command window(show_status(...)) should be used instead. The left footer area is also used by uDraw(Graph) to show system information, so it is possible that the messages supplied here are overwritten. In multi-view and multi-window mode, this operation affects all views of the current context. The parameter "string" can be a language key starting with "#%..." to use the internationalization feature for multilingual interfaces.

## window(show_status(lang_string))

Displays a message "string" in the right footer area of the base window. This command should be used to show permanent information like the current status. For temporary information, command window(show_message(...)) should be used instead. The right footer area is not used by uDraw(Graph) to show system information. In multi-view and multi-window mode, this operation affects all views of the current context. The parameter "string" can be a language key starting with "#%..." to use the internationalization feature for multilingual interfaces.

## window(position(integer,integer))

Sets the origin (i.e. upper left corner) of the base window to the given coordinates, where the first "integer" is the new x coordinate (in pixel) and the second is the new y coordinate. Do not use negative values or values larger than the screen. In multi-view mode, this operation will only affect the master view, of the current context.

## window(size(integer,integer))

Sets the width and height of the base window to the given values, where the first "integer" is the new window width (in pixel) and the second is the new height. Do not use negative values or values larger than the screen. In multi-view mode, this operation will only affect the master view, of the current context.

## window(raise)

Raises the base window to the front such that it lays on top of all the other windows. In multi-view mode, this operation will only affect the master view, of the current context.

## window(iconify)

Iconifies the base window, so it will disappear, but is still available by an iconic symbol. To undo this command, use window(deiconify). In multi-view and multi-window mode, this operation affects all views of the current context.

## window(deiconify)

Deiconifies the base window, so it will appear again if it was iconified before. To undo this command, use window(iconify). In multi-view and multi-window mode, this operation affects all views of the current context.

## window(deactivate)

Disables all user input in uDraw(Graph). This will affect the whole system, especially all views/windows of all contexts in multi-graph mode. After disabling the windows, the user is unable to manipulate any element of the user interface, so no event answers are sent to the application until the windows will be enabled again with command window(activate).

## window(activate)

Enables the user input in uDraw(Graph) again after this has been disabled before with window(deactivate). Even in multi-graph, multi-view and multi-window mode, the whole system is affected by this command and not only the views/windows of the current context.

## window(background(string))

Sets the background of the base window to the color specified by parameter "string". This is a RGB value like "#0f331e" in the same format as used for command-line option -graphbg.

## window(file_browser(boolean,lang_string,lang_string,string,string,btypes,boolean))

Note: This command returns the answer browser_answer instead of the usual answer ok!

With this command, the application can use the uDraw(Graph) file browser for its own purpose (on Microsoft® platforms, this command will show the native Windows® file browser and on Mac OS® X platforms, this will show the native Mac OS® file browser which does not have all the features described below). This file browser does not start any operation in uDraw(Graph) after the user has selected a file. Instead, the selected file (and chosen type) is returned to the application by sending answer browser_answer. Due to the manifold features of the file browser, the application has to specify several parameters with the following semantic:

- boolean (first one)
  Flag for opening a file. Use true when the browser is used to open a file and use false when the file is saved. There are two differences between an open and save browser: In opposition to the save browser, the open browser does not ask the user for confirmation when the selected file already exist and it does not allow to choose a file that does not exist.
- string (first one)
  Window title of the file browser. This parameter can be a language key starting with "#%..." to use the internationalization feature for multilingual interfaces.
- string (second one)
  Short text label used for the leftmost button that is responsible for closing the browser. Should be usually "Open", "Save" or something like that. This parameter can be a language key starting with "#%..." to use the internationalization feature for multilingual interfaces.
- string (third one)
  Initial directory of the browser. If empty (i.e. ""), the home directory of the user is used as default.
- string (forth one)
  Initial file name of the browser in the initial directory, can be empty (i.e. ""). The entry of the selection field of the browser at start-up will be composed by the initial directory and the initial file.
- btypes
  A list of file type (i.e. suffix) specifications, available in the "Types" menu of the browser. The list must have at least one entry to retrieve the default type of the browser which is always the first type of the list. An empty list is not allowed and will force an error. Each element of this list is composed by three string parameters:

  bt(lang_string,string,lang_string)

  Here, the first string is a plain text description of the type (e.g. "GIF Files"), the second string is a file type pattern for the suffix (e.g. "*.gif") and the third string is a postfix for the title of the file browser (e.g. "GIF"), so the complete title is "Open GIF" when the GIF type is selected. This part of the browser title will change when the user switches to another file type. The first and third string parameter (not the file type pattern!) can be a language key starting with "#%..." to use the internationalization feature for multilingual interfaces.

  Complete btype example:
  [bt("GIF Files","*.gif","GIF"),bt("All Files,"*","")]

- boolean (second one)
  Flag to show hidden files initially. Should be usually false to filter the hidden files. The user can modify this setting at any time by using the "Show hidden" check button of the browser.

In opposite to the file browsers used by uDraw(Graph), the file browser available with this command is modal (i.e. it will block all user input in any other uDraw(Graph) window), until it is closed by the user. At this time, the application will be informed about the selected file with API answer browser_answer(string,string), where the first "string" is the absolute file name of the selected file and the second "string" is the plain text of the current type selected in the browser (i.e. the first parameter of the "bt" list elements in the example shown above). Both strings are empty when the user has canceled the file browser.