Embedding ggobi FAQ

  • What are the basic steps in embedding ggobi into another application?
    Well, you first have to write code to initialize the ggobi engine and then compile it and link against the ggobi library. First you want to call the
    GGOBI(main)();
    routine to create a ggobi instance and optionally pass it command line arguments to initialize it with the appropriate state. Next, compile the code, make certain to add the directory containing GGobiAPI.h to the list of directories the pre-processor searches (ie. via the -I flag). Finally, link against the ggobi library (add -L<wherever libggobi.so is located> -lggobi to the link command). Now, to get ggobi to respond to use actions, etc., make certain to call gtk_main() at some suitable point in your application. Integrating this with your event loop (if you have one) can be complex.

    Some examples of embedding ggobi in different programming environments are provided in the R, Perl and Python interfaces.

  • In some situations I want to add additional items to the menu on the main window of a gobbi instance, i.e. the variable panel window. How can I do that?
    You can get access to the menu and all its sub-items via the field main_menu_factory object in the ggobid structure. This is a reference to a GtkItemFactory object and one can use it to find the different elements. For example, in the Python interface to ggobi, we add a Suspend button to the File menu in the following way:
      menu = GTK_MENU(gtk_item_factory_get_widget(gg->main_menu_factory, "/File"));
      suspend = gtk_menu_item_new_with_label ("Suspend");
      gtk_menu_append( GTK_MENU(menu), suspend);      
    
    You can use this to get a reference to the different widgets in the menu (i.e. menu items, menus and sub-menus, etc.) and add, remove and change their characteristics.
  • How do I get the compilation and linker flags for ggobi so that I can find the header files, libraries etc. when compiling my own application with GGobi embedded?
    There are two ways to do this: pkg-config and ggobi-config. The preferred way is to use the general pkg-config tool. This reuses a well-documented and established application that is familiar to many. It has a rich feature set relative to what we want, allowing standard flags and application-specific variables to be queried. If pkg-config is not installed on your machine, a home-grown version "equivalent" is available in the form of the ggobi-config script. This will gradually be phased out or left to decay as pkg-config is a nicer way of doing this.

  • Duncan Temple Lang <duncan@research.bell-labs.com>
    Last modified: Tue Nov 23 16:51:50 PST 2004