The most simple GPHIGS program with GPHIGS-GUI
Steps are :
Read Configuration File -> pxset_conf_file_name
Open PHIGS popen_phigs -> popen_phigs
Open Workstation -> popen_ws
Set Event mode for locator -> pset_loc_mode
Wait locator to exit -> pawait_event
Use :
Clic mouse in workstation -> exit
<shift> button3 -> popup menu GUI
#include <phigs.h>
main()
{
Pin_class class;
Pint wkid, device, i;
pxset_conf_file_name ( "simple.def" );
popen_phigs ( PDEF_ERR_FILE,PDEF_MEM_SIZE );
popen_ws (1,"/dev/tty",8887 );
pset_loc_mode (1,1,POP_EVENT,PSWITCH_ECHO );
for (;;) {
pawait_event (0., &wkid, &class, &device);
if ( class == PIN_LOC ) {
pclose_ws (1);
pclose_phigs ();
break;
}
}
}
This program creates a X11 type workstation and waits for locator -type validation (mouse click) in the window before outputting.
In order to access GPHIGS-GUI, simply position the cursor in the graphic window (the widget) and press on <shift> key and 3rd mouse button.
A popup-menu is displayed which enables all the GPHIGS-GUI functions to be used
In this case, the program is written only with PHIGS. (it does not therefore include XtMainLoop) This is the case, for example, for a program developed with GPHIGS. Under these circumstances, all the GPHIGS_GUI functions are available at any time and at any point in the program.
Relink the application with the new library by adding the Motif libraries ( libXm.a ), and Intrinsics ( libXt.a ) and possibly, depending on the machine, libPW.a. If the program is re-run as it is, the new functions are displayed (MOTIF-type look). Motif inputs are activated dynamically by the configuration file. The default GPHIGS configuration file is GPHIGS.def, however, it may be given another name in which case it must be called, to then be loaded in the application, via the pxset_conf_file_name function (see GPHIGS documentation)
The addition of the command :
%mi no
( mi = Motif interface )
to the configuration file inactivates the GPHIGS_GUI toolkit. This command must be repeated for every workstation. ( %wk command ).
Thus in a very user-friendly way, and without having to modify the application, it is possible to choose dynamically either "look and feel" via the configuration file, PIM-type look which will remain valid irrespective of the type of station, or Motif look for stations having the OSF library .
By relinking the application with the new library, all the interactions are simulated by GPHIGS_GUI, i.e. :
- the workstation is replaced by a GPHIGS widget which provides access to the GPHIGS-GUI menu.
- the GPHIGS inputs are replaced by the same type of inputs in MOTIF
GPHIGS-GUI is therefore used at all times in the program.
It has the following architecture :

Note : if there is no active input in the program, the pxgui_wait function must be used .