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.

  • Duncan Temple Lang <duncan@research.bell-labs.com>
    Last modified: Fri Feb 9 04:51:44 EST 2001