GTXclient C API GTXserver-16.0.2

- Main Page
- Related Pages
- Data Structures
- Files
- Examples

# motif_client.c example

See motif_client.c source code.

This example is a GTXserver client with an Motif user interface. To be compiled and linked, this program needs Motif includes and libraries. Before reading this part, you should have read the two previous example descriptions. This text only presents the main differences between text_client example and this one.

After parsing arguments and initializing X Toolkit, the interface is created in st_create_interf. It consists of two windows (forms). The first presents parameters for connection. It allows to run a local GTXserver and connect to it or connect to an already running server. In the second case, you must indicate the machine and port the server is running on. The second window/form masked at launch, contains the current list of elements (studies,directories...) and zones where information appears. By the item list, there is a second list for macro variable indices. After connection, the two main forms are swapped, i.e: the first is popped down and the second appears. The interface also contains a status zone.

Instead of the actions used in text_client, we will use motif callbacks in the list to set current items and button callbacks for the other actions.

Just after the interface creation, GTX_ERROR_FUNCTION() is overriden to redirect all errors in the status zone. To do so, a static function st_status_function() is created. The string returned by the server is always a single line string. This allows the string to be directly set in the status zone.