4.4. Load a Window Created in PhAB

#!/usr/cogent/bin/phgamma

/* This example is the first of three ways to incorporate a
 * PhAB-created GUI into a Gamma program.  It loads from PhAB a window
 * similar to the one created in the last example, and attaches
 * callbacks to the widgets.  This illustrates an advantage of using
 * Gamma and PhAB together.  Complex widgets can be created and
 * changed quickly in PhAB, while callbacks and other code can be
 * attached easily in Gamma.*/
 
require_lisp("PhotonWidgets.lsp");
require_lisp("PhabTemplate.lsp");
PtInit(nil);

/*
 * Load the window that was previously created in PhAB.
 */
PhabLoad (string(_os_, "-WidgetFiles/wgt/colortest.wgtw"));

/*
 * Attach callbacks.
 */
PtAttachCallback(entrybox,Pt_CB_TEXT_CHANGED,
                 #entry = parse_string(entrybox.text_string));
PtAttachCallback(entrybox,Pt_CB_ACTIVATE,#colorpane.fill_color = entry);
PtAttachCallback(exitbutcolortest,Pt_CB_ACTIVATE,#exit_program(-1));

PtRealizeWidget(colortest);
PtMainLoop();